Skip to content

feat: add Sentinel RocketMQ 5.x adapter module - #4377

Open
oss-sentinel-ai wants to merge 1 commit into
alibaba:2025.1.xfrom
oss-sentinel-ai:feat/sentinel-rocketmq-5x-adapter
Open

feat: add Sentinel RocketMQ 5.x adapter module#4377
oss-sentinel-ai wants to merge 1 commit into
alibaba:2025.1.xfrom
oss-sentinel-ai:feat/sentinel-rocketmq-5x-adapter

Conversation

@oss-sentinel-ai

Copy link
Copy Markdown

Summary

This PR adds a new module spring-cloud-alibaba-sentinel-rocketmq that provides Sentinel integration for Apache RocketMQ 5.x.

Problem

The existing sentinel-rocketmq-adapter module in the Sentinel project only supports RocketMQ 4.x. With RocketMQ 5.x having a completely different API, we need a new adapter module specifically designed for RocketMQ 5.x.

Solution

Created a new Spring Boot starter module that:

  • Provides SentinelProducerInterceptor for producer flow control and circuit breaking
  • Provides SentinelConsumerInterceptor for consumer flow control and circuit breaking
  • Uses RocketMQ 5.x hook mechanism (SendMessageHook and ConsumeMessageHook)
  • Supports topic-based resource naming for fine-grained Sentinel rules
  • Auto-configures when both RocketMQ and Sentinel are present
  • Exposes configuration via Spring Boot properties

Changes

  • Added spring-cloud-alibaba-sentinel-rocketmq module
  • Implemented producer and consumer interceptors using Sentinel Entry API
  • Added auto-configuration with @ConditionalOnProperty support
  • Included unit tests for auto-configuration
  • Updated parent pom and dependencies BOM

Configuration Example

spring:
  cloud:
    sentinel:
      rocketmq:
        enabled: true
        producer:
          flow-control-enabled: true
          circuit-breaker-enabled: true
          resource-prefix: "rocketmq-producer:"
        consumer:
          flow-control-enabled: true
          circuit-breaker-enabled: true
          resource-prefix: "rocketmq-consumer:"

Testing

  • Unit tests for auto-configuration included
  • Tested with RocketMQ 5.3.1 client
  • Compatible with Spring Boot 4.x and Java 17+

Fixes #3854


Automated PR by github-manager-bot

- Create spring-cloud-alibaba-sentinel-rocketmq module for RocketMQ 5.x
- Implement SentinelProducerInterceptor for producer flow control
- Implement SentinelConsumerInterceptor for consumer flow control
- Add auto-configuration with customizable properties
- Support topic-based resource naming for fine-grained control
- Include unit tests for auto-configuration
- Add module to parent pom and dependencies BOM

This module provides Sentinel integration for Apache RocketMQ 5.x,
which is not supported by the existing sentinel-rocketmq-adapter
(that only supports RocketMQ 4.x).

Fixes alibaba#3854
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants