{"record":{"id":"33c2c1d636ab3388","repo":"alibaba/spring-cloud-alibaba","slug":"message-hasn-t-been-sent-cause-by-the-sendtype-m","errorCode":null,"errorMessage":"message hasn't been sent,cause by : the SendType must be in this values[OneWay, Async, Sync]","messagePattern":"message hasn't been sent,cause by : the SendType must be in this values\\[OneWay, Async, Sync\\]","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/outbound/RocketMQProducerMessageHandler.java","lineNumber":249,"sourceCode":"\t\tif (RocketMQProducerProperties.SendType.Sync\n\t\t\t\t.equalsName(mqProducerProperties.getSendType())) {\n\t\t\tif (null != selector) {\n\t\t\t\treturn defaultMQProducer.send(mqMessage, selector, args);\n\t\t\t}\n\t\t\treturn defaultMQProducer.send(mqMessage);\n\t\t}\n\t\tif (RocketMQProducerProperties.SendType.Async\n\t\t\t\t.equalsName(mqProducerProperties.getSendType())) {\n\t\t\tif (null != selector) {\n\t\t\t\tdefaultMQProducer.send(mqMessage, selector, args,\n\t\t\t\t\t\tthis.getSendCallback(message));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdefaultMQProducer.send(mqMessage, this.getSendCallback(message));\n\t\t\t}\n\t\t\treturn sendResult;\n\t\t}\n\t\tthrow new MessagingException(\n\t\t\t\t\"message hasn't been sent,cause by : the SendType must be in this values[OneWay, Async, Sync]\");\n\t}\n\n\t/**\n\t * https://github.com/alibaba/spring-cloud-alibaba/issues/1408 .\n\t * @param message message\n\t * @return SendCallback\n\t */\n\tprivate SendCallback getSendCallback(Message<?> message) {\n\t\tSendCallback sendCallback = RocketMQBeanContainerCache\n\t\t\t\t.getBean(mqProducerProperties.getSendCallBack(), SendCallback.class);\n\t\tif (null == sendCallback) {\n\t\t\tsendCallback = new SendCallback() {\n\t\t\t\t@Override\n\t\t\t\tpublic void onSuccess(SendResult sendResult) {\n\t\t\t\t}\n\n\t\t\t\t@Override","sourceCodeStart":231,"sourceCodeEnd":267,"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/outbound/RocketMQProducerMessageHandler.java#L231-L267","documentation":"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.","triggerScenarios":"`spring.cloud.stream.rocketmq.bindings.<output>.producer.sendType` is set to a value that does not case-insensitively equal OneWay, Async, or Sync.","commonSituations":"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.","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."],"exampleFix":"// before\nspring:\n  cloud:\n    stream:\n      rocketmq:\n        bindings:\n          out1:\n            producer:\n              sendType: Asyc   # typo -> [133]\n# after\n              sendType: Async","handlingStrategy":"validation","validationCode":"// Validate sendType against the enum before starting the producer.\nString st = StringUtils.trimAllWhitespace(mqProducerProperties.getSendType());\nboolean ok = RocketMQProducerProperties.SendType.OneWay.equalsName(st)\n          || RocketMQProducerProperties.SendType.Async.equalsName(st)\n          || RocketMQProducerProperties.SendType.Sync.equalsName(st);\nAssert.isTrue(ok, \"sendType must be one of OneWay/Async/Sync, was: \" + st);","typeGuard":"// Type guard narrowing sendType.\nstatic Optional<RocketMQProducerProperties.SendType> parseSendType(String s) {\n    if (s == null) return Optional.empty();\n    return Arrays.stream(RocketMQProducerProperties.SendType.values())\n        .filter(t -> t.equalsName(s)).findFirst();\n}","tryCatchPattern":null,"preventionTips":["Whitelist sendType values at config load (trim whitespace).","Document valid values next to the property.","Validate enums in a @ConfigurationProperties validator."],"tags":["rocketmq","producer","config","send"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}