apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.
https://rocketmq.apache.org/
Apache License 2.0
21.19k stars 11.67k forks source link

reocketmqDashboard不兼容rocketmq5.0? #8216

Open pzx6b666 opened 5 months ago

pzx6b666 commented 5 months ago

Is Your Feature Request Related to a Problem?

用下面这种方式监听消息,消息能监听到,但是rocketmq-Dashboard 上面不显示这个监听实例数量,订阅组后面的消息为0,但 public class PushConsumerExample { private static final Logger log = LoggerFactory.getLogger(PushConsumerExample.class);

private PushConsumerExample() { }

public static void main(String[] args) throws ClientException, InterruptedException, IOException { final ClientServiceProvider provider = ClientServiceProvider.loadService();

// Credential provider is optional for client configuration.
String accessKey = "yourAccessKey";
String secretKey = "yourSecretKey";
SessionCredentialsProvider sessionCredentialsProvider =
    new StaticSessionCredentialsProvider(accessKey, secretKey);

String endpoints = "foobar.com:8080";
ClientConfiguration clientConfiguration = ClientConfiguration.newBuilder()
    .setEndpoints(endpoints)
    // On some Windows platforms, you may encounter SSL compatibility issues. Try turning off the SSL option in
    // client configuration to solve the problem please if SSL is not essential.
    // .enableSsl(false)
    .setCredentialProvider(sessionCredentialsProvider)
    .build();
String tag = "yourMessageTagA";
FilterExpression filterExpression = new FilterExpression(tag, FilterExpressionType.TAG);
String consumerGroup = "yourConsumerGroup";
String topic = "yourTopic";
// In most case, you don't need to create too many consumers, singleton pattern is recommended.
PushConsumer pushConsumer = provider.newPushConsumerBuilder()
    .setClientConfiguration(clientConfiguration)
    // Set the consumer group name.
    .setConsumerGroup(consumerGroup)
    // Set the subscription for the consumer.
    .setSubscriptionExpressions(Collections.singletonMap(topic, filterExpression))
    .setMessageListener(messageView -> {
        // Handle the received message and return consume result.
        log.info("Consume message={}", messageView);
        return ConsumeResult.SUCCESS;
    })
    .build();
// Block the main thread, no need for production environment.
Thread.sleep(Long.MAX_VALUE);
// Close the push consumer when you don't need it anymore.
// You could close it manually or add this into the JVM shutdown hook.
pushConsumer.close();

} }

image

Describe the Solution You'd Like

1

Describe Alternatives You've Considered

1

Additional Context

1

Willhow-Gao commented 5 months ago

You should raise an issue in rocketmq-dashboard https://github.com/apache/rocketmq-dashboard