MQBrokerException brokerException = (MQBrokerException) e.getCause(); return new OMSRuntimeException("-1", String.format("Received a broker exception, Topic=%s, msgId=%s, %s", topic, msgId, brokerException.getErrorMessage()), e);
mt.setTrackType(TrackType.NOT_ONLINE); mt.setExceptionDesc("CODE:" + e.getResponseCode() + " DESC:" + e.getErrorMessage()); result.add(mt); continue; mt.setTrackType(TrackType.NOT_ONLINE); mt.setExceptionDesc("CODE:" + e.getResponseCode() + " DESC:" + e.getErrorMessage()); result.add(mt); continue;
@Override public void onException(Throwable e) { if (!pullRequest.getMessageQueue().getTopic().startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)) { if (e instanceof MQBrokerException) { log.warn("execute the pull request exception,code={},err msg={}", ((MQBrokerException) e).getResponseCode(), ((MQBrokerException) e).getErrorMessage()); } else { log.warn("execute the pull request exception", e); } } DefaultMQPushConsumerImpl.this.executePullRequestLater(pullRequest, PULL_TIME_DELAY_MILLS_WHEN_EXCEPTION); } };
OMSRuntimeException checkProducerException(String topic, String msgId, Throwable e) { if (e instanceof MQClientException) { if (e.getCause() != null) { if (e.getCause() instanceof RemotingTimeoutException) { return new OMSTimeOutException("-1", String.format("Send message to broker timeout, %dms, Topic=%s, msgId=%s", this.rocketmqProducer.getSendMsgTimeout(), topic, msgId), e); } else if (e.getCause() instanceof MQBrokerException || e.getCause() instanceof RemotingConnectException) { MQBrokerException brokerException = (MQBrokerException) e.getCause(); return new OMSRuntimeException("-1", String.format("Received a broker exception, Topic=%s, msgId=%s, %s", topic, msgId, brokerException.getErrorMessage()), e); } } // Exception thrown by local. else { MQClientException clientException = (MQClientException) e; if (-1 == clientException.getResponseCode()) { return new OMSRuntimeException("-1", String.format("Topic does not exist, Topic=%s, msgId=%s", topic, msgId), e); } else if (ResponseCode.MESSAGE_ILLEGAL == clientException.getResponseCode()) { return new OMSMessageFormatException("-1", String.format("A illegal message for RocketMQ, Topic=%s, msgId=%s", topic, msgId), e); } } } return new OMSRuntimeException("-1", "Send message to RocketMQ broker failed.", e); }
public List<String> findConsumerIdList(final String topic, final String group) { String brokerAddr = this.findBrokerAddrByTopic(topic); if (null == brokerAddr) { this.updateTopicRouteInfoFromNameServer(topic); brokerAddr = this.findBrokerAddrByTopic(topic); } if (null != brokerAddr) { try { return this.mQClientAPIImpl.getConsumerIdListByGroup(brokerAddr, group, 3000); } catch (MQBrokerException e) { log.warn("getConsumerIdListByGroup exception, addr={}, group={}, code={},msg={}", brokerAddr, group, e.getResponseCode(), e.getErrorMessage()); } catch (Exception e) { log.warn("getConsumerIdListByGroup exception, " + brokerAddr + " " + group, e); } } return null; }
mt.setTrackType(TrackType.NOT_ONLINE); mt.setExceptionDesc("CODE:" + e.getResponseCode() + " DESC:" + e.getErrorMessage()); result.add(mt); continue; mt.setTrackType(TrackType.NOT_ONLINE); mt.setExceptionDesc("CODE:" + e.getResponseCode() + " DESC:" + e.getErrorMessage()); result.add(mt); continue;
MQBrokerException brokerException = (MQBrokerException) e.getCause(); return new OMSRuntimeException("-1", String.format("Received a broker exception, Topic=%s, msgId=%s, %s", topic, msgId, brokerException.getErrorMessage()), e);
mt.setTrackType(TrackType.NOT_ONLINE); mt.setExceptionDesc("CODE:" + e.getResponseCode() + " DESC:" + e.getErrorMessage()); result.add(mt); continue; mt.setTrackType(TrackType.NOT_ONLINE); mt.setExceptionDesc("CODE:" + e.getResponseCode() + " DESC:" + e.getErrorMessage()); result.add(mt); continue;