jms - Apache Qpid JMS 客户端消息生产者卡住并且未传递到队列
问题描述
我正在尝试通过 AMQP 1.0 协议向 Qpid 代理发送消息。该队列已命名queue2
,并且已在默认虚拟主机下创建。但是,producer.send(message)
永远卡住了。相同的代码可用于连接到 Azure 服务总线。我正在使用 qpid-jms-client 0.58。生产者代码是:
Hashtable<String, String> hashtable = new Hashtable<>();
hashtable.put("connectionfactory.myFactoryLookup", protocol + "://" + url + "?amqp.idleTimeout=120000&amqp.traceFrames=true");
hashtable.put("queue.myQueueLookup", queueName);
hashtable.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.qpid.jms.jndi.JmsInitialContextFactory");
Context context = new InitialContext(hashtable);
ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
queue = (Destination) context.lookup("myQueueLookup");
Connection connection = factory.createConnection(username, password);
connection.setExceptionListener(new AmqpConnectionFactory.MyExceptionListener());
connection.start();
Session session=connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// session.createQueue("queue3");
Queue queue = new JmsQueue("queue2");
MessageProducer messageProducer = session.createProducer(queue);
TextMessage textMessage = session.createTextMessage("new message");
messageProducer.send(textMessage)
生产时应用程序的线程转储
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000078327c550> (a org.apache.qpid.jms.provider.ProgressiveProviderFuture)
at java.lang.Object.wait(Object.java:502)
at org.apache.qpid.jms.provider.ProgressiveProviderFuture.sync(ProgressiveProviderFuture.java:154)
- locked <0x000000078327c550> (a org.apache.qpid.jms.provider.ProgressiveProviderFuture)
at org.apache.qpid.jms.JmsConnection.send(JmsConnection.java:773)
at org.apache.qpid.jms.JmsNoTxTransactionContext.send(JmsNoTxTransactionContext.java:37)
at org.apache.qpid.jms.JmsSession.send(JmsSession.java:964)
at org.apache.qpid.jms.JmsSession.send(JmsSession.java:843)
at org.apache.qpid.jms.JmsMessageProducer.sendMessage(JmsMessageProducer.java:252)
at org.apache.qpid.jms.JmsMessageProducer.send(JmsMessageProducer.java:182)
我试图运行这个给出相同结果的例子。
解决方案
推荐阅读
- python - PipelineException:在输入中找不到 mask_token ([MASK])
- sql - 仅显示每家商店利润最高的日期
- javascript - 更漂亮的 shell 脚本格式
- javascript - 使用 gatsbyJs 进行 SEO 的动态页面
- java - TypedQuery 错误“未设置所有命名参数”。JPA/休眠
- node.js - Font-Awesome 在 NodeJs 应用程序上本地工作,但不在 Heroku 上
- python - 从 plumbum.cmd 导入 git、grep、sed、wc
- discord - 如果有一定数量的成员,如何创建一个宣布它的事件?(不和谐.py)
- c# - iText 表 SetKeepTogether 重复标题行
- powershell - 用于将多个用户添加到 O365 组的 Powershell