繁体   English   中英

JMS队列-在发送和接收对象消息之间有10秒的暂停

[英]JMS queue - 10 second pause between sending and receiving object message

我的服务器中有两个应用程序,并通过ActiveMQ使用JMS在两者之间发送消息。 我的两个应用程序如下

Web服务-接受HTTP请求,进行验证,然后发送要由其他应用程序执行的消息。

Exec App-接受对象消息,执行命令,将执行报告发送回Web服务以呈现给客户端。

我的Exec应用程序在200毫秒内从Web服务接收消息,那里没有问题。 但是,当我发送执行报告时,该消息可能在Web服务接收之前在队列中挂起10秒钟以上。 我为双方的消费者使用了相同的代码,所以我不确定是什么原因。

这是我在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();
    }
}

[有一个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());
                }
            }
        };

我收到日志消息“正在发送执行报告”,然后长达15秒钟后Web服务中什么都没有,直到最后我收到“传入...”

这可能是什么原因?

确保在Exec App上运行了足够的MDB,以便它们可以处理负载。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM