alibaba/spring-cloud-alibaba · error · MessagingException
message hasn't been sent,cause by : the SendType must be in
Error message
message hasn't been sent,cause by : the SendType must be in this values[OneWay, Async, Sync]
What it means
send(...) falls through every SendType branch and throws MessagingException when mqProducerProperties.getSendType() matches none of OneWay, Async, Sync (case-insensitive). The default is Sync; an invalid value (e.g. typo, foreign enum) cannot be dispatched.
Source
Thrown at spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/integration/outbound/RocketMQProducerMessageHandler.java:249
if (RocketMQProducerProperties.SendType.Sync
.equalsName(mqProducerProperties.getSendType())) {
if (null != selector) {
return defaultMQProducer.send(mqMessage, selector, args);
}
return defaultMQProducer.send(mqMessage);
}
if (RocketMQProducerProperties.SendType.Async
.equalsName(mqProducerProperties.getSendType())) {
if (null != selector) {
defaultMQProducer.send(mqMessage, selector, args,
this.getSendCallback(message));
}
else {
defaultMQProducer.send(mqMessage, this.getSendCallback(message));
}
return sendResult;
}
throw new MessagingException(
"message hasn't been sent,cause by : the SendType must be in this values[OneWay, Async, Sync]");
}
/**
* https://github.com/alibaba/spring-cloud-alibaba/issues/1408 .
* @param message message
* @return SendCallback
*/
private SendCallback getSendCallback(Message<?> message) {
SendCallback sendCallback = RocketMQBeanContainerCache
.getBean(mqProducerProperties.getSendCallBack(), SendCallback.class);
if (null == sendCallback) {
sendCallback = new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
}
@OverrideView on GitHub (pinned to 115d590110)
Solutions
- Set sendType to exactly one of: OneWay, Async, or Sync (case-insensitive).
- Trim any whitespace from env-var-provided values.
- Re-check the property key spelling and remove stale overrides.
Example fix
// before
spring:
cloud:
stream:
rocketmq:
bindings:
out1:
producer:
sendType: Asyc # typo -> [133]
# after
sendType: Async Defensive patterns
Strategy: validation
Validate before calling
// Validate sendType against the enum before starting the producer.
String st = StringUtils.trimAllWhitespace(mqProducerProperties.getSendType());
boolean ok = RocketMQProducerProperties.SendType.OneWay.equalsName(st)
|| RocketMQProducerProperties.SendType.Async.equalsName(st)
|| RocketMQProducerProperties.SendType.Sync.equalsName(st);
Assert.isTrue(ok, "sendType must be one of OneWay/Async/Sync, was: " + st); Type guard
// Type guard narrowing sendType.
static Optional<RocketMQProducerProperties.SendType> parseSendType(String s) {
if (s == null) return Optional.empty();
return Arrays.stream(RocketMQProducerProperties.SendType.values())
.filter(t -> t.equalsName(s)).findFirst();
} Prevention
- Whitelist sendType values at config load (trim whitespace).
- Document valid values next to the property.
- Validate enums in a @ConfigurationProperties validator.
When it happens
Trigger: `spring.cloud.stream.rocketmq.bindings.<output>.producer.sendType` is set to a value that does not case-insensitively equal OneWay, Async, or Sync.
Common situations: A typo like `Asyc`, `sync ` (trailing space), or `oneway `; a value sourced from an env var with whitespace; a stale config key after a version rename.
Related errors
- Binding for channel {destination.getName()} has been disable
- TransactionMQProducer must have a TransactionListener !!!
- empty after conversion [messageConverter:%s,payloadClass:%s,
- topic must not be empty
- group must be configured for DLQ{destination.getName()}
AI-assisted analysis of alibaba/spring-cloud-alibaba@115d590110 (2026-08-14).
Data as JSON: /api/errors/33c2c1d636ab3388.
Report an issue: GitHub.