Alibaba Cloud Message Queue RocketMQ Demo

repository·master·Indexed 42 days ago

https://github.com/aliwaremq/mq-demo

Usage examples for Alibaba Cloud Message Queue RocketMQ version 4.0. Demonstrates integration into Java applications using both Spring-based SDKs (version 1.8.8.5.Final or 1.6.0.Final and above) and non-Spring TCP clients.

Tokens
709
Snippets
1
Records
5
Agent score
3%

What's inside RocketMQ

  1. How to use the mq-demo example program

    master
    To use this demonstration program, you should first familiarize yourself with the official RocketMQ 4.0 Quick Start documentation to understand the core concepts of the service. After that, you can choose between the Spring-based integration or the non-Spring (TCP) integration depending on your application architecture.
  2. Integrate RocketMQ without Spring (TCP)

    master
    If you are not using the Spring framework, you can integrate the message queue directly using the client via TCP. Examples for Java TCP integration can be found in the tcp/java-tcp-demo directory of this repository.
  3. Integrate RocketMQ using Spring

    master

    For Spring applications, it is recommended to use the SDK (version 1.8.8.5.Final or higher), which provides all Client types as Spring Beans.

    Configuration is managed via XML files located in the resources directory. You must modify common.xml before running the demo to provide your specific credentials and resource identifiers.

    ### Required Configuration Files in `resources/`:
    
    * `common.xml`: Configure AccessKey (AK), SecretKey (SK), Topic, Producer ID (PID), and Consumer ID (CID).
    * `producer.xml`: Configuration for a standard Producer.
    * `order_producer.xml`: Configuration for an `OrderProducer`.
    * `transaction_producer.xml`: Configuration for a `TransactionProducer`.
    * `consumer.xml`: Configuration for a standard Consumer.
    * `order_consumer.xml`: Configuration for an `OrderConsumer`.
    * `batch_consumer.xml`: Configuration for a `BatchConsumer`.
  4. Configure Aliyun RocketMQ Spring XML files

    master

    Before running the demo, you must modify the configuration files in the resources directory.

    • common.xml: Contains core resource configurations including AccessKey (AK), SecretKey (SK), Topic, Producer ID (PID), and Consumer Group ID (CID).
    • producer.xml: Configuration for a standard Producer.
    • order_producer.xml: Configuration for an OrderProducer.
    • transaction_producer.xml: Configuration for a TransactionProducer.
    • consumer.xml: Configuration for a standard Consumer.
    • order_consumer.xml: Configuration for an OrderConsumer.
    • batch_consumer.xml: Configuration for a BatchConsumer.