直到ejbTimeout结束,MDB onMessage才开始。它不应该异步启动吗?

| 我们有一个javax.ejb.TimedObject,它将消息排队到MDB,就像这样...
ctx = new InitialContext();
QueueConnectionFactory qCF = (QueueConnectionFactory) ctx
        .lookup(\"java:comp/env/jms/queueconnfactory\");
Queue q = (Queue) ctx.lookup(\"java:comp/env/jms/queue\");
conn = qCF.createQueueConnection();
session = conn.createQueueSession(true,
        Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(q);
TextMessage txtMsg = session.createTextMessage();
txtMsg.setLongProperty(JobMonitorUtil.JOB_REFERENCE_ID, filingId);
txtMsg.setLongProperty(JobMonitorUtil.JOB_ID, jobId);
txtMsg.setLongProperty(JobMonitorUtil.JOB_RUN_SID, jobRunSId);
sender.send(txtMsg);
session.close();
conn.close();
当我调试此文件时(在Weblogic 10.3.1.0上),我跳过了sender.sent(txtMsg)行,并且希望onMessage断点几乎立即被命中。直到我让ejbTimeout运行(实际上是我退出TimerImpl.timerExpired时),它才达到我的断点。消息队列在生成消息的同一服务器上。 在我看来,这很奇怪。 MDB消息不是异步发送的吗? 这可能是配置问题,还是应该如何工作?
已邀请:
您创建了一个事务会话。在提交事务之前,不会发送JMS消息(否则将无法回滚-消息已到达远程系统)。 当您调用session.close()时,将提交事务。 解决方案是(例如)创建一个非事务会话:
session = conn.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);

要回复问题请先登录注册