What port is used on the client machine to send messages to rabbitmq?

547 Views Asked by At

I have created a small class for demonstration purpose that sends a message to rabbitmq on a specific port:

class RabbitMqPublisher
{
    private IAdvancedBus _advancedBus;
    public RabbitMqPublisher()
    {
        _advancedBus = RabbitHutch.CreateBus("host=rabbitmq-server:5672;virtualHost=/;username=user;password=pass").Advanced;
    }

    public void PublishMessage(string message)
    {
        var routingKey = "SimpleMessage";

        // declare some objects
        var queue = _advancedBus.QueueDeclare("TestQueue.SimpleMessage");
        var exchange = _advancedBus.ExchangeDeclare("TestExchange.SimpleMessage", ExchangeType.Direct);
        var binding = _advancedBus.Bind(exchange, queue, routingKey);

        _advancedBus.Publish(exchange, routingKey, true, new Message<string>(message));
    }
}

In this case the port on which the RabbitMQ server is waiting for messages is 5672. My question is besides that, what port is used by the client to send this message, and would it be possible to configure it?

1

There are 1 best solutions below

1
Alex - Exaland Concept On

15672 FROM HTTP API CLIENT

Port Access

Firewalls and other security tools may prevent RabbitMQ from binding to a port. When that happens, RabbitMQ will fail to start. Make sure the following ports can be opened:

4369: epmd, a peer discovery service used by RabbitMQ nodes and CLI tools

5672, 5671: used by AMQP 0-9-1 and 1.0 clients without and with TLS

25672: used by Erlang distribution for inter-node and CLI tools communication and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). See networking guide for details.

15672: HTTP API clients and rabbitmqadmin (only if the management plugin is enabled)

61613, 61614: STOMP clients without and with TLS (only if the STOMP plugin is enabled)

1883, 8883: (MQTT clients without and with TLS, if the MQTT plugin is enabled

15674: STOMP-over-WebSockets clients (only if the Web STOMP plugin is enabled)

15675: MQTT-over-WebSockets clients (only if the Web MQTT plugin is enabled)

Reference doc: https://www.rabbitmq.com/install-windows-manual.html