edit-icon download-icon

Run the demo

Last Updated: Jun 21, 2018

Start Sending and Receiving Messages in Main Method

  1. Run SimpleMQProducer class to send a message.

  2. Log on to the MQ console, in the left-side navigation pane select Message Query > By Topic, and select the topic name to be queried. You can see that the message has been sent to the topic.

  3. Run SimpleMQConsumer class to receive a message. You can see the log that shows the message is received and printed. The initialization will take seconds, which doesn’t often occur in the production environment.

In the MQ console, go to Consumers > Consumer Status, and you can see the started consumer is online and the subscription relationship is consistent in the Consumer Status Information section.

Start Sending and Receiving Messages in Spring Method

  1. Run MQProducer4Spring class to send a message.
  2. Run MQConsumer4Spring class to receive a message.

The process for viewing the result is similar to that shown above.

Send Transactional Messages

Run SimpleTransactionProducer class to send a message.

Note: LocalTransactionCheckerImpl class is the check interface class for local transactions. It is used for verifying transactions. For detailed information, see Send and Receive Transactional Message.

Send and Receive Ordered Messages

Run SimpleOrderConsumer class to receive a message.

Run SimpleOrderProducer class to send a message.

Note: Message delivery and consumption is processed in order. For detailed information, see Send and Receive Ordered Message.

Send Scheduled/Delayed Messages

Run MQTimerProducer class to send a message. The message will be delivered in 3 seconds.

Note: You can specify an exact delivery time, which is up to 40 days. For detailed information, see Send and Receive Scheduled Message.

Thank you! We've received your feedback.