[英]JMS queue - 10 second pause between sending and receiving object message
I have two applications within my server, and use JMS via ActiveMQ to send messages between the two. 我的服务器中有两个应用程序,并通过ActiveMQ使用JMS在两者之间发送消息。 My two apps are as follows 我的两个应用程序如下
Web service - accepts HTTP requests, validates, then sends messages to be executed by the other application. Web服务-接受HTTP请求,进行验证,然后发送要由其他应用程序执行的消息。
Exec App - accepts object messages, executes order, sends execution report back to the web service to present to the client. Exec App-接受对象消息,执行命令,将执行报告发送回Web服务以呈现给客户端。
My Exec app receives messages from the Web service within 200ms, no problems there. 我的Exec应用程序在200毫秒内从Web服务接收消息,那里没有问题。 However when I send an exec report, the message can hang in the queue for over 10 seconds before being received by the web service. 但是,当我发送执行报告时,该消息可能在Web服务接收之前在队列中挂起10秒钟以上。 I am using the same code for both side's consumers so I am unsure what the cause would be. 我为双方的消费者使用了相同的代码,所以我不确定是什么原因。
Here is my message producer in the Exec App - 这是我在Exec App中的消息生成器-
public void createAndSendExecReport(OrderExecutionReport theReport){
try {
logger.debug("Posting exec report: " +theReport.getOrderId());
this.excChannelMessageProducer.send(createMessage(theReport));
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
[there is a createMessage method which converts my POJO into an object message] [有一个createMessage方法将我的POJO转换为目标消息]
MessageListener listener = new MessageListener() {
@Override
public void onMessage(Message message) {
logger.debug("Incoming execution report");
try {
OrderExecutionReport report = (OrderExecutionReport)((ObjectMessage)message).getObject();
consumeExecutionReport(report);
} catch (Exception e) {
logger.error("Message handling failed. Caught: " + e);
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
logger.error(sw.toString());
}
}
};
I get the log message "sending execution report" Then nothing in the web service for up to 15 seconds later until finally I get "incoming ... " 我收到日志消息“正在发送执行报告”,然后长达15秒钟后Web服务中什么都没有,直到最后我收到“传入...”
What could be the cause of this? 这可能是什么原因?
确保在Exec App上运行了足够的MDB,以便它们可以处理负载。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.