Skip to content

Help developers quickly integrate RocketMQ in Spring Boot. Support the Spring Message specification to facilitate developers to quickly switch from other MQ to RocketMQ.

License

Notifications You must be signed in to change notification settings

liuxiany/rocketmq-spring-boot-starter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rocketmq-spring-boot-starter

License

Quick Start

<!--add dependency in pom.xml-->
<dependency>
    <groupId>org.rocketmq.spring.boot</groupId>
    <artifactId>rocketmq-spring-boot-starter</artifactId>
    <version>1.0.0.RELEASE</version>
</dependency>

Consume Message

## application.properties
spring.rocketmq.name-server=127.0.0.1:9876
rocketmq4.x:
spring.rocketmq.nameService=127.0.0.1:9876

More relevant configurations for produce:

spring.rocketmq.producer.retry-times-when-send-async-failed=0
spring.rocketmq.producer.send-msg-timeout=300000
spring.rocketmq.producer.compress-msg-body-over-howmuch=4096
spring.rocketmq.producer.max-message-size=4194304
spring.rocketmq.producer.retry-another-broker-when-not-store-ok=false
spring.rocketmq.producer.retry-times-when-send-failed=2

Note:

Maybe you need change 127.0.0.1:9876 with your real NameServer address for RocketMQ

@SpringBootApplication
@EnableRocketMQ
public class RocketMQApplication {
    public static void main(String[] args) {
        SpringApplication.run(RocketMQApplication .class,args);
    }
}


@Slf4j
@Service
@RocketMQListener(topic = "topic-1")
public class MyConsumer1 {
     @RocketMQMessage(messageClass = String.class,tag = "tag-1")
     public void onMessage(String message) {
         log.info("received message: {}", message);
     }
}
    

About

Help developers quickly integrate RocketMQ in Spring Boot. Support the Spring Message specification to facilitate developers to quickly switch from other MQ to RocketMQ.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%