我有以下制作人:
XMLMessageProducer producer = session.getMessageProducer(new JCSMPStreamingPublishEventHandler() {
@Override
public void handleError(String messageID, JCSMPException cause, long timestamp) {
logger.error("Error occurred when sending message {} ", messageID, cause);
}
// This method is only invoked for persistent and non-persistent
// messages.
@Override
public void responseReceived(String messageID) {
logger.info("Response received for message {} ", messageID);
}
});
在调用producer.send()
向主题发布消息时,我如何知道是否有任何错误,因为responseReceived()
没有为直接消息调用而调用?由于消息是异步发布handleError()
的,什么时候JCSMPStreamingPublishEventHandler
调用?我应该等多久才能得出发布消息没有错误的结论?
谢谢你。