我只是发送一个字符串,我不知道为什么会这样。 client-version: 4.5.2 server-version: 4.5.2
希望有人能帮助我!
private void sendMission(String pushId) {
try {
Message message = new Message();
message.setTopic(missionTpoic);
message.setBody(pushId.getBytes("utf-8"));
log.info("sendMission to MQ begin , message : {}", message);
rocketMQService.getProducer().send(message, new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
log.info( "======== onSuccess ========== {}", sendResult);
}
@Override
public void onException(Throwable e) {
log.error( "======== onException ==========", e);
}
}, 10000L);
log.info("sendMission to MQ end, message : {}", message);
} catch (Exception e) {
throw new BusinessRuntimeException(BaseExceptionCode.SYSTEM_ERROR.getAdminCode(), e, "Occur a error when push message into mq.");
}
log.info("sendMissionDone!!! pushId : {}", pushId);
}
例外情况如下:
2021-03-26 16:06:13 {:} 错误 [AsyncSenderExecutor_1] cpbpcSuperPushMissionExecutor:138 -- ======== onException ==========
java.util.ConcurrentModificationException:空
在 java.util.HashMap$HashIterator.nextNode(HashMap.java:1445)
在 java.util.HashMap$EntryIterator.next(HashMap.java:1479)
在 java.util.HashMap$EntryIterator.next(HashMap.java:1477)
在 org.apache.rocketmq.common.message.MessageDecoder.messageProperties2String(MessageDecoder.java:387)
在 org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendKernelImpl(DefaultMQProducerImpl.java:767)
在 org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:557)
在 org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.access 300 美元(DefaultMQProducerImpl.java:90)
在 org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl$3.run(DefaultMQProducerImpl.java:491)
在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
在 java.util.concurrent.FutureTask.run(FutureTask.java:266)
在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
在 java.lang.Thread.run(Thread.java:748)