alibaba/spring-ai-alibaba · error · RuntimeException

Failed to send message

Error message

Failed to send message

What it means

MqProducerManager.send wraps any exception from the RocketMQ producer.send() synchronous call (network errors, broker unavailable, topic not found, message property violations). The message was not delivered to the broker.

Solutions

  1. Check MQ endpoint, credentials, and topic configuration in MqConfigProperties
  2. Retry the send with backoff; synchronous sends are retry-safe if idempotency is handled
  3. Log and persist failed messages to an outbox for later re-delivery
  4. Verify broker connectivity and message size/property limits
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/mq/MqProducerManager.java:66 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/6f1cb6d1cce0f106. Report an issue: GitHub.

Appendix: source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/mq/MqProducerManager.java:66

	private static final ClientServiceProvider provider = ClientServiceProvider.loadService();

	/** MQ configuration properties */
	private final MqConfigProperties mqConfigProperties;

	/**
	 * Sends a message synchronously
	 * @param producer MQ producer instance
	 * @param message Message to be sent
	 * @return Send result containing message ID
	 */
	public SendResult send(Producer producer, MqMessage message) {
		try {
			SendReceipt sendReceipt = producer.send(buildMessage(message));
			return SendResult.builder().messageId(sendReceipt.getMessageId().toString()).build();
		}
		catch (Exception e) {
			log.error("Failed to send message, topic: {}", message.getTopic(), e);
			throw new RuntimeException("Failed to send message", e);
		}
	}

	/**
	 * Sends a delayed message synchronously
	 * @param producer MQ producer instance
	 * @param message Message to be sent
	 * @param delaySeconds Delay time in seconds
	 * @return Send result containing message ID
	 */
	public SendResult sendDelay(Producer producer, MqMessage message, int delaySeconds) {
		try {
			// 计算延迟时间戳
			long deliveryTimestamp = System.currentTimeMillis() + (delaySeconds * 1000L);
			message.setDeliveryTimestamp(deliveryTimestamp);

			SendReceipt sendReceipt = producer.send(buildMessage(message));
			return SendResult.builder().messageId(sendReceipt.getMessageId().toString()).build();

View on GitHub (pinned to f82da0b50f)