12월, 2022의 게시물 표시

RabbitMQ -Python Client (MQTT) #5 : MQTT implementation in RabbitMQ

이미지
 So far, we have looked at how to use the RabbitMQ protocol of the AMQP standard. RabbitMQ supports the MQTT protocol as well as AMQP. MQTT is more lightweight than AMQP and was created considering poor network environment. Therefore, it is designed to be used in IoT devices that have low computing power and are exposed to outdoor environments. A typical MQTT message broker is Mosquitto. I have previously presented C++ and Python examples of working with the Mosquitto Message Broker. MQTT - Python Client MQTT - C/C++ Client However, RabbitMQ also supports the MQTT protocol. This time I will look at how to use the MQTT protocol in RabbitMQ. Enabling MQTT in RabbitMQ docker image The Docker images tested so far have MQTT disabled. To activate the MQTT plugin, docker must be newly built and used as follows. # cat Dockerfile FROM rabbitmq:management RUN rabbitmq-plugins enable --offline rabbitmq_mqtt Then build the new docker image. # docker build -t rmqcustom . Run the ...

RabbitMQ - C++ Client (Exchange) #4 : How to use the 4 types of Exchange

이미지
 This example is the 3rd example Publish/Subscribe on the https://www.rabbitmq.com/getstarted.html page. Some of the content is quoted from "RabbitMQ in Depth" published in 2018 by Manning Press. Publish/Subscribe The difference from the previous example is that X (Exchange) exists between Publisher and Subscriber. Most real-world projects use Exchange to pass messages rather than putting them directly into a queue. Exchange can simultaneously put messages on multiple bound queues. In addition, it provides flexibility to increase or change queues bound to Exchange from the Rabbit MQ management page without modifying the Publisher program. Subscribers in the originally provided source code create queues and bind to Exchange at runtime. But I don't like it this way. I will create Exchanges and Queues in the admin page beforehand and then bind them. <Pre-created Exchanges and Queues> emit_log(Producer) #!/usr/bin/env python import pika import sys connection ...