Multiple Mqtt brokers in different ports ? #159
Answered
by
BEagle1984
felixalguzman
asked this question in
Q&A
-
Is it possible to connect to different mqtt brokers running in different ports ? |
Beta Was this translation helpful? Give feedback.
Answered by
BEagle1984
Mar 11, 2022
Replies: 1 comment 1 reply
-
Yes, you can definitely connect to multiple MQTT and/or Kafka brokers from the same application, having completely different settings for each client. The client configuration can be completely set or overridden inside the public class MyEndpointsConfigurator : IEndpointsConfigurator
{
public void Configure(IEndpointsConfigurationBuilder builder) =>
builder
.AddMqttEndpoints(endpoints => endpoints
.AddInbound(endpoint => endpoint
.Configure(config => config.WithClientId("client1").ConnectViaTcp("broker1", 1111))
.ConsumeFrom("some/topic"))
.AddInbound(endpoint => endpoint
.Configure(config => config.WithClientId("client1").ConnectViaTcp("broker2", 2222))
.ConsumeFrom("other/topic")));
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
felixalguzman
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, you can definitely connect to multiple MQTT and/or Kafka brokers from the same application, having completely different settings for each client.
The client configuration can be completely set or overridden inside the
AddInbound
configuration action, using theConfigure
method.