RabbitMQ message template -RabbitTemplate spring of integration
RabbitTemplate: message template. It's spring rabbit integration provides message templates. It is the class key of the transmitted message.
This article has Kaige Java (kaigejava) released
Features:
This class provides a wealth of transmission method, the method comprising the reliability of message delivery, message callback listener interfaces ConfirmCallback, the return value of the interface ReturnCallBack like confirmation. Similarly, we need to inject into the spring container, then you can think of other bean as normal use.
Code Example:
1: RabbitMQConfig Add rabbit class Template statement:
/** |
After this, template spring container was managed. When in use, it can be directly autoWried.
In the test class:
Start the test class, the control station the received message queue to see:
We see, queue001 there a message.
In the page control table, find the corresponding queue. We used here is queue001 point into view:
You can get messages as seen in FIG. Click to get Messages button, we'll get to.
We can see that in the data headers. Attr This is our extra added. It is also received into.
Description, we use a simple message template has been successful.
This article is " RabbitMQ succinctly series" tutorial: RabbitMQ succinctly series Chapter 20. Advanced Integration Application Title III rabbitTemplate objects . Series of tutorials, recommended to see from the first chapter.
Kaige personal blog: www.kaigejava.com
Original Source: http: //kaigejava.com/article/detail/534
Under Section notice: SimpleMessageListenerContainer