RabbitMQ and relationship between channel and connection

后端 未结 4 867
温柔的废话
温柔的废话 2020-11-28 00:25

The RabbitMQ Java client has the following concepts:

  • Connection - a connection to a RabbitMQ server instance
  • Channel - ???
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 01:15

    There is a relation between like A TCP connection can have multiple Channels.

    Channel: It is a virtual connection inside a connection. When publishing or consuming messages from a queue - it's all done over a channel Whereas Connection: It is a TCP connection between your application and the RabbitMQ broker.

    In multi-threading architecture, you may need a separate connection per thread. That may lead to underutilization of TCP connection, also it adds overhead to the operating system to establish as many TCP connections it requires during the peak time of the network. The performance of the system could be drastically reduced. This is where the channel comes handy, it creates virtual connections inside a TCP connection. It straightaway reduces the overhead of the OS, also it allows us to perform asynchronous operations in a more faster, reliable and simultaneously way.

提交回复
热议问题