{"record":{"id":"289c3e7f131d0cea","repo":"alibaba/spring-cloud-alibaba","slug":"defaultmqpushconsumer-init-failed-caused-by-e-ge","errorCode":null,"errorMessage":"DefaultMQPushConsumer init failed, Caused by {e.getMessage()}","messagePattern":"DefaultMQPushConsumer init failed, Caused by (.+?)","errorType":"exception","errorClass":"MessagingException","httpStatus":null,"severity":"error","filePath":"spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/integration/inbound/RocketMQInboundChannelAdapter.java","lineNumber":118,"sourceCode":"\t\t\t\t\t\t\t\t\t\t\t\t\t.getSuspendCurrentQueueTimeMillis());\n\t\t\t\t\t\t\t\t\treturn ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT;\n\t\t\t\t\t\t\t\t}, () -> ConsumeOrderlyStatus.SUCCESS));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tpushConsumer.registerMessageListener((MessageListenerConcurrently) (msgs,\n\t\t\t\t\t\tcontext) -> RocketMQInboundChannelAdapter.this\n\t\t\t\t\t\t\t\t.consumeMessage(msgs, () -> {\n\t\t\t\t\t\t\t\t\tcontext.setDelayLevelWhenNextConsume(\n\t\t\t\t\t\t\t\t\t\t\textendedConsumerProperties.getExtension()\n\t\t\t\t\t\t\t\t\t\t\t\t\t.getPush()\n\t\t\t\t\t\t\t\t\t\t\t\t\t.getDelayLevelWhenNextConsume());\n\t\t\t\t\t\t\t\t\treturn ConsumeConcurrentlyStatus.RECONSUME_LATER;\n\t\t\t\t\t\t\t\t}, () -> ConsumeConcurrentlyStatus.CONSUME_SUCCESS));\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tlog.error(\"DefaultMQPushConsumer init failed, Caused by \" + e.getMessage());\n\t\t\tthrow new MessagingException(MessageBuilder.withPayload(\n\t\t\t\t\t\"DefaultMQPushConsumer init failed, Caused by \" + e.getMessage())\n\t\t\t\t\t.build(), e);\n\t\t}\n\t}\n\n\t/**\n\t * The actual execution of a user-defined input consumption service method.\n\t * @param messageExtList rocket mq message list\n\t * @param failSupplier {@link ConsumeConcurrentlyStatus} or\n\t *     {@link ConsumeOrderlyStatus}\n\t * @param sucSupplier {@link ConsumeConcurrentlyStatus} or\n\t *     {@link ConsumeOrderlyStatus}\n\t * @param <R> object\n\t * @return R\n\t */\n\tprivate <R> R consumeMessage(List<MessageExt> messageExtList,\n\t\t\tSupplier<R> failSupplier, Supplier<R> sucSupplier) {\n\t\tif (CollectionUtils.isEmpty(messageExtList)) {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/alibaba/spring-cloud-alibaba/blob/115d5901102009492e05d5ec18c3f79cad4077d0/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/integration/inbound/RocketMQInboundChannelAdapter.java#L100-L136","documentation":"RocketMQInboundChannelAdapter's push-consumer constructor wraps any exception raised while building/starting the DefaultMQPushConsumer into a MessagingException whose payload repeats the cause's message. It is the umbrella failure for consumer initialization (name server unreachable, bad credentials, ACL/access-channel mismatch, duplicate consumer group, etc.).","triggerScenarios":"Any exception escapes the try block that initializes the push consumer in the adapter constructor (e.g. MQClientException from the RocketMQ client during DefaultMQPushConsumer construction).","commonSituations":"Wrong/empty `name-server`; missing `access-key`/`secret-key` on a secured broker; `accessChannel` left LOCAL when using RocketMQ cloud (should be CLOUD); duplicate consumer group across incompatible instances; broker down; wrong region endpoint.","solutions":["Read the appended `Caused by` to identify the real RocketMQ client error first.","Verify `spring.cloud.stream.rocketmq.binder.name-server` resolves and is reachable.","For RocketMQ cloud, set `accessChannel: CLOUD` and provide valid `access-key`/`secret-key`.","Ensure the consumer `group` is unique and exists/is creatable on the broker."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-flight: confirm name-server + access channel before context refresh.\nRocketMQConsumerProperties p = extendedConsumerProperties.getExtension();\nAssert.notNull(p.getNameServer(), \"nameServer is required\");\nif (AccessChannel.CLOUD.name().equals(p.getAccessChannel())) {\n    Assert.hasText(p.getAccessKey(), \"access-key required for CLOUD access channel\");\n    Assert.hasText(p.getSecretKey(), \"secret-key required for CLOUD access channel\");\n}","typeGuard":null,"tryCatchPattern":"// Surface the real cause rather than the wrapper.\ntry {\n    applicationContext.refresh();\n} catch (org.springframework.messaging.MessagingException |\n         org.springframework.beans.factory.BeanCreationException ex) {\n    Throwable root = nestedInstanceOf(ex, org.apache.rocketmq.client.exception.MQClientException.class);\n    log.error(\"Push consumer init failed (root): {}\", root != null ? root.getMessage() : ex.getMessage());\n    throw ex;\n}","preventionTips":["Always inspect the `Caused by`, never the wrapper message.","Pre-flight name-server reachability and ACL settings.","Distinguish LOCAL vs CLOUD access channel for RocketMQ cloud brokers."],"tags":["rocketmq","consumer","startup","network","config"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}