Skip to content

Multiple Mqtt brokers in different ports ? #159

Answered by BEagle1984
felixalguzman asked this question in Q&A
Discussion options

You must be logged in to vote

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 the Configure method.

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"))

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@felixalguzman
Comment options

Answer selected by felixalguzman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants