-
Notifications
You must be signed in to change notification settings - Fork 11.7k
RIP 2 RocketMQ Spring
Current State: Implemented
Authors: Kevin Wang
Shepherds: Vongosling
Mailing List Discussion:
Pull Request: #PR_NUMBER
Released: <released_version>
Apache RocketMQ is the top-level project of the Apache Software Foundation, which is used widely both in both China and the rest of the world by more and more developers, it provides convenient and multi-language APIs.
With the popularity of Spring Cloud and Spring Boot among developers, it is required to wrap RocketMQ API with Spring style and work with Spring to allow developers easily integration with Spring cloud/boot with less code and less configuration.
There has been provided a tentative project rocketmq-spring-boot-starter in RocketMQ community, it provides flexible annotations and POJOs to work with Spring, we intend to enhance the project with more features, documents and usage demos in the near future and contribute this to Spring community as a standard messaging microservice besides RabbitMQ and Kafka.
- Merge latest features of RocketMQ into spring-rocketmq
- Attract more developers join the project
- Push the spring-rocketmq to Spring community
We hope with the spring-rocketmq, the developers and cloud users can use the RocketMQ easy and smooth in the Spring Cloud world.
In this phase, the project is designed to only support Spring Boot, not support the Spring Integration or Spring Cloud Stream.
The project will only support in Java languate and Spring framework.
Pushing the project to Spring needs the approval of goalkeeper of Pivotal.
This is an accessional project to generate an embedded RocketMQ Broker in a standalone jar, it is majorly used in spring-rocketmq test scenarios instead of using it in a production environment.
Distributed transactional message is an important new feature in RocketMQ 4.3.0 release, we need this function in spring-rocketmq producer API. Currently, the project has supported the following features: RocketMQTemplate: It provides a "template" as a high-level abstraction for sending messages;
@RocktMQMessageListener: The annotation works with Message-driven POJOs and implements the callback method to consume messages.
@RocketMQMessageListener(topic = "${spring.rocketmq.topic}", consumerGroup = "string_consumer")
public class StringConsumer implements RocketMQListener<String> {
@Override
public void onMessage(String message) {
log.info("------- StringConsumer received: {}", message);
}
}
The enhancement will add the below changes on producer side:
- Add new annotation @RocketMQTransactionListener to define Executor and Checker implementations
@RocketMQTransactionListener(transName = TRANS_NAME)
class TransactionListenerImpl implements TransactionListener {
@Override
public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
..
}
@Override
public LocalTransactionState checkLocalTransaction(MessageExt msg) {
...
}
}
- Add new methods to send transactional message in RocketMQTemplate class:
public TransactionSendResult sendMessageInTransaction(String txProducerName, org.apache.rocketmq.common.message.Message rocketMsg, Object arg) throws MQClientException {
...
}
public TransactionSendResult sendMessageInTransaction(String txProducerName, String destination, org.springframework.message.Message<?>msg, Object arg) throws MQClientException {
...
}
In order to pull request (or become a new) Spring project, we’d like to refactor the source code to add more comments and format with Spring concepts.
Reference the below section:
None of these is essential for a pull request, but they will all help. They can also be added after the original pull request but before a merge.
Use the Spring Framework code format conventions (import eclipse-code-formatter.xml from the root of the project if you are using Eclipse).
Make sure all new .java files to have a simple Javadoc class comment with at least an @author tag identifying you, and preferably at least a paragraph on what the class is for.
Add the ASF license header comment to all new .java files (copy from existing files in the project)
Add yourself as an @author to the .java files that you modify substantially (more than cosmetic changes).
Add some Javadocs and, if you change the namespace, some XSD doc elements.
A few unit tests would help a lot as well - someone has to do it.
If no-one else is using your branch, please rebase it against the current master (or another target branch in the main project).
It might be required to change the package name of each class before doing the final merge.
For users quickly start to use the spring-rocketmq, we will provide a demo and usage document.
The orginal demo project is in https://github.com/aqlu/rocketmq-demo.git. The enhancement will move it into the RocketMQ samples project and with completed documentation.
Copyright © 2016~2022 The Apache Software Foundation.
- Home
- RocketMQ Improvement Proposal
- User Guide
- Community