alibaba/spring-cloud-alibaba · error · MessagingException
DefaultMQPushConsumer init failed, Caused by {e.getMessage()
Error message
DefaultMQPushConsumer init failed, Caused by {e.getMessage()} What it means
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.).
Source
Thrown at spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/integration/inbound/RocketMQInboundChannelAdapter.java:118
.getSuspendCurrentQueueTimeMillis());
return ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT;
}, () -> ConsumeOrderlyStatus.SUCCESS));
}
else {
pushConsumer.registerMessageListener((MessageListenerConcurrently) (msgs,
context) -> RocketMQInboundChannelAdapter.this
.consumeMessage(msgs, () -> {
context.setDelayLevelWhenNextConsume(
extendedConsumerProperties.getExtension()
.getPush()
.getDelayLevelWhenNextConsume());
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}, () -> ConsumeConcurrentlyStatus.CONSUME_SUCCESS));
}
}
catch (Exception e) {
log.error("DefaultMQPushConsumer init failed, Caused by " + e.getMessage());
throw new MessagingException(MessageBuilder.withPayload(
"DefaultMQPushConsumer init failed, Caused by " + e.getMessage())
.build(), e);
}
}
/**
* The actual execution of a user-defined input consumption service method.
* @param messageExtList rocket mq message list
* @param failSupplier {@link ConsumeConcurrentlyStatus} or
* {@link ConsumeOrderlyStatus}
* @param sucSupplier {@link ConsumeConcurrentlyStatus} or
* {@link ConsumeOrderlyStatus}
* @param <R> object
* @return R
*/
private <R> R consumeMessage(List<MessageExt> messageExtList,
Supplier<R> failSupplier, Supplier<R> sucSupplier) {
if (CollectionUtils.isEmpty(messageExtList)) {View on GitHub (pinned to 115d590110)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight: confirm name-server + access channel before context refresh.
RocketMQConsumerProperties p = extendedConsumerProperties.getExtension();
Assert.notNull(p.getNameServer(), "nameServer is required");
if (AccessChannel.CLOUD.name().equals(p.getAccessChannel())) {
Assert.hasText(p.getAccessKey(), "access-key required for CLOUD access channel");
Assert.hasText(p.getSecretKey(), "secret-key required for CLOUD access channel");
} Try / catch
// Surface the real cause rather than the wrapper.
try {
applicationContext.refresh();
} catch (org.springframework.messaging.MessagingException |
org.springframework.beans.factory.BeanCreationException ex) {
Throwable root = nestedInstanceOf(ex, org.apache.rocketmq.client.exception.MQClientException.class);
log.error("Push consumer init failed (root): {}", root != null ? root.getMessage() : ex.getMessage());
throw ex;
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- group must be configured for DLQ{destination.getName()}
- DefaultMQPushConsumer not initialized
- ConfigService is not initialized
- ConfigService not available
- ApplicationContext or FeignClientFactory not initialized
AI-assisted analysis of alibaba/spring-cloud-alibaba@115d590110 (2026-08-14).
Data as JSON: /api/errors/289c3e7f131d0cea.
Report an issue: GitHub.