Relationship of RabbitMQ connection channel

Original link: https://www.ahianzhang.com/post/rabbit-network/

The Rabbit java client sends the message code as follows 1 2 3 4 5 6 7 8 Connection connection = connectionFactory.newConnection(); Channel channel = connection.createChannel(); AMQP.BasicProperties basicProperties = new AMQP.BasicProperties().builder() .messageId (UUID.randomUUID().toString()) .build(); channel.basicPublish(“biz”,”dev.hello”,false,basicProperties,”Hello World”.getBytes()); channel.close(); connection.close(); For AMQP 0-9-1 network connection, a client will establish a Tcp long connection (Connection) with the Broker, and use a lightweight connection (Channel) to achieve the effect of multiplexing.

This article is reprinted from: https://www.ahianzhang.com/post/rabbit-network/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment