paascloud/paascloud-master · critical · TpcBizException

TPC100500014

TPC100500014

Error message

TPC100500014

What it means

TPC100500014 ("MQ重试三次,仍然发送失败, Topic=%s, MessageKey=%s") is thrown by RocketMqProducer.retrySendMessage when sending the message fails on every attempt up to PRODUCER_RETRY_TIMES (3). Each underlying exception is logged, and once retries are exhausted the TpcBizException is raised with the topic and message key. The message was not delivered to the broker.

Solutions

  1. Check the '发送消息失败' log entries for the root exception on each of the 3 attempts (broker address, error code).
  2. Verify the RocketMQ nameserver/broker are reachable and the topic exists (autoCreateTopic or create it manually).
  3. Confirm the producer group id (pid) is configured and its producer bean started successfully in MqProducerBeanFactory.
  4. Re-send the message after fixing connectivity; RocketMQ send is idempotent per key, so retry with the same key is safe.
  5. Implement a local outbox/persistent queue for critical messages so failures can be replayed later.

Example fix

// before: fire and forget, message lost on failure
RocketMqProducer.sendSimpleMessage(body, topic, tag, key, pid, 0);
// after: capture failure and persist for replay
try {
    RocketMqProducer.sendSimpleMessage(body, topic, tag, key, pid, 0);
} catch (TpcBizException e) {
    outboxRepository.save(new OutboxMessage(topic, tag, key, body)); // replay later
}
Defensive patterns

Strategy: retry

Validate before calling

if (!producerHealthy(pid)) { // producer bean started and broker reachable
    throw new IllegalStateException("MQ producer not ready: " + pid);
}
if (!brokerTopicExists(topic)) { throw new IllegalStateException("topic missing: " + topic); }

Try / catch

try {
    RocketMqProducer.sendSimpleMessage(body, topic, tag, key, pid, delayLevel);
} catch (TpcBizException e) {
    if (e.getCode() == 10050014) {
        log.error("MQ send exhausted retries topic={} key={}", topic, key, e);
        outbox.save(topic, tag, key, body); // persist for replay
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling sendSimpleMessage when the RocketMQ producer bean (looked up by pid) repeatedly fails to send: broker down, nameserver unreachable, topic does not exist, producer not started, or message rejected by the broker.

Common situations: RocketMQ cluster outage or network partition; topic deleted or autoCreateTopicEnable=false; wrong producer group (pid) configured; broker disk-full causing send rejections; credentials/ACL failures after a broker upgrade.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/682e795d8162810d. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-tpc/src/main/java/com/paascloud/provider/mq/RocketMqProducer.java:59

		Message message = MqMessage.checkMessage(body, topic, tag, key);
		if (delayLevel < 0 || delayLevel > GlobalConstant.Number.EIGHTEEN_INT) {
			throw new TpcBizException(ErrorCodeEnum.TPC100500013, topic, key);
		}
		message.setDelayTimeLevel(delayLevel);
		return retrySendMessage(pid, message);
	}

	private static SendResult retrySendMessage(String pid, Message msg) {
		int iniCount = 1;
		SendResult result;
		while (true) {
			try {
				result = MqProducerBeanFactory.getBean(pid).send(msg);
				break;
			} catch (Exception e) {
				log.error("发送消息失败:", e);
				if (iniCount++ >= PRODUCER_RETRY_TIMES) {
					throw new TpcBizException(ErrorCodeEnum.TPC100500014, msg.getTopic(), msg.getKeys());
				}
			}
		}
		log.info("<== 发送MQ SendResult={}", result);
		return result;
	}

}

View on GitHub (pinned to 781281a950)