- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
根据关于在 hornetq 中使用 JMSTemplate 的长期信息,我们在连接到服务器时一直在使用 CachingConnectionFactory。这是一个示例配置,与我们正在使用的配置非常相似:
<bean id="jmsConnectionFactory" class="org.hornetq.jms.client.HornetQJMSConnectionFactory">
<constructor-arg name="ha">
<value>false</value>
</constructor-arg>
<constructor-arg name="initialConnectors">
<bean class="org.hornetq.api.core.TransportConfiguration">
<constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" />
<constructor-arg>
<map key-type="java.lang.String" value-type="java.lang.Object">
<entry>
<key>
<util:constant static-field="org.hornetq.core.remoting.impl.netty.TransportConstants.HOST_PROP_NAME"/>
</key>
<value>${message-server.host}</value>
</entry>
<entry>
<key>
<util:constant static-field="org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME"/>
</key>
<value>${message-server.port}</value>
</entry>
</map>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
<bean id="connectionFactory"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="jmsConnectionFactory" />
<property name="username" value="${message-server.user-name}" />
<property name="password" value="${message-server.password}" />
</bean>
<bean id="caching.connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="connectionFactory" />
<property name="sessionCacheSize" value="${session-cache}" />
<property name="cacheProducers" value="${cache-producers}" />
<property name="cacheConsumers" value="${cache-consumers}" />
</bean>
<bean id="transactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="connectionFactory" />
</bean>
<!-- Input Integration -->
<bean id="inputTopic" class="org.hornetq.jms.client.HornetQTopic">
<constructor-arg>
<value>${topicName}</value>
</constructor-arg>
</bean>
<int-jms:message-driven-channel-adapter connection-factory="connectionFactory"
destination="inputTopic"
transaction-manager="transactionManager"
pub-sub-domain="true"
channel="command.serialized.objectInputChannel" />
这已经为我们工作了将近 3 年。当尝试升级到最新的 hornetq 库时,我们遇到类似这样的异常:
2014-05-22 08:56:59,063 [Service-0] ERROR Error sending event to channel allOutput.channel
org.springframework.integration.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler#0]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:79) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:178) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:149) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:330) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:169) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
... lines omitted to fit
at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:169) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:134) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:178) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:149) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
at c.i.e.p.ListenerChannelAdapter.sendEventToChannel(ListenerChannelAdapter.java:147) [processing-library-1.6.0-SNAPSHOT.jar:na]
at c.i.e.p.ListenerChannelAdapter.update(ListenerChannelAdapter.java:75) [processing-library-1.6.0-SNAPSHOT.jar:na]
at com.espertech.esper.core.service.EPRuntimeImpl.processMatches(EPRuntimeImpl.java:924) [esper-4.9.0.jar:na]
at com.espertech.esper.core.service.EPRuntimeImpl.processWrappedEvent(EPRuntimeImpl.java:459) [esper-4.9.0.jar:na]
at com.espertech.esper.core.thread.InboundUnitSendMap.run(InboundUnitSendMap.java:54) [esper-4.9.0.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_55]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_55]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_55]
Caused by: org.springframework.jms.IllegalStateException: Producer is closed; nested exception is javax.jms.IllegalStateException: Producer is closed
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:279) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:494) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:566) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:689) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.integration.jms.JmsSendingMessageHandler.send(JmsSendingMessageHandler.java:139) ~[spring-integration-jms-3.0.2.RELEASE.jar:na]
at org.springframework.integration.jms.JmsSendingMessageHandler.handleMessageInternal(JmsSendingMessageHandler.java:112) ~[spring-integration-jms-3.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73) ~[spring-integration-core-3.0.2.RELEASE.jar:na]
... 140 common frames omitted
Caused by: javax.jms.IllegalStateException: Producer is closed
at org.hornetq.jms.client.HornetQMessageProducer.checkClosed(HornetQMessageProducer.java:520) ~[hornetq-jms-client-2.4.1.Final.jar:na]
at org.hornetq.jms.client.HornetQMessageProducer.getDeliveryMode(HornetQMessageProducer.java:127) ~[hornetq-jms-client-2.4.1.Final.jar:na]
at org.springframework.jms.connection.CachedMessageProducer.<init>(CachedMessageProducer.java:89) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.getCachedProducer(CachingConnectionFactory.java:388) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.invoke(CachingConnectionFactory.java:331) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at com.sun.proxy.$Proxy16.createProducer(Unknown Source) ~[na:na]
at org.springframework.jms.core.JmsTemplate.doCreateProducer(JmsTemplate.java:1044) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.core.JmsTemplate.createProducer(JmsTemplate.java:1025) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:598) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.core.JmsTemplate$3.doInJms(JmsTemplate.java:569) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:491) ~[spring-jms-4.0.4.RELEASE.jar:4.0.4.RELEASE]
... 145 common frames omitted
经调查似乎与缓存的使用有关,但是否应该缓存似乎没有任何明确的答案。
hornetq/jboss 的人们似乎指出不使用缓存是一种反模式,正如我多年来阅读的几篇文章所指出的,这里就是这样一篇文章:
https://community.jboss.org/wiki/CanIUseTheSpringJMSTemplateWithHornetQ
但是 spring 的一些人似乎有不同的意见。
我看过 Gary Russell 关于这个主题的一些笔记 (https://stackoverflow.com/users/1240763/gary-russell)
一些帖子指出不要将 CachingConnectionFactory 与 DefaultMessageListenerContainer 一起使用。
When is it appropriate to cacheConsumers when using Spring CachingConnectionFactory?
Closing Session when using Spring's CachingConnectionFactory
我们检查并从我们所有的 int-jms:message-driven-channel-adapter 中删除了 CachingConnectionFactory,并且仍然看到上述异常,直到我关闭了消费者和生产者的缓存它消失了。
谁能告诉我缓存应该如何工作,如果我们正确设置了它,这是新的 hornetq 服务器中的一个错误吗?
最佳答案
您使用的是哪个版本的 spring?我相信这实际上是由 spring 中的一个错误引起的,该错误导致它无法与 JMS 2.0 一起正常工作。
参见 Spring 4 CachingConnectionFactory with JMS 2.0 doesn't properly cache Producers和 https://jira.spring.io/browse/SPR-11949
基本上,您至少需要使用 Spring 4.0.6,或已修复此错误的 4.1RC1。
关于java - 我应该还是不应该将 CachingConnectionFactory 与 hornetq 2.4.1 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23808386/
有没有办法在同一个虚拟机中启动多个 HornetQ 嵌入式代理?例如,在同一进程中运行且完全不相关的两个独立应用程序。 如果我尝试注册第二个 EmbeddedJms 实例,而一个实例已经在运行,这就是
我正在尝试用我自己的测试项目重新创建 HornetQ 示例。但是我遇到了类加载器问题。显然,我缺少文档中未指定的一些依赖项。 文档让我添加 hornetq-core-client.jar netty.
如何使用 HornetQ 以编程方式创建 JMS 主题和队列? 最佳答案 http://docs.jboss.org/hornetq/2.2.14.Final/user-manual/en/html/
我构建了一个 Spring JMS 解决方案,该解决方案是针对 JBoss 7.1.1 和外部 HornetQ 实现 2.2.1.4 构建的。此连接并成功运行。 但是我现在使用 EAP6,并尝试连接到
(在 11.11.11 编辑,底部编辑) 我有两个运行 HornetQ(2.2.5 AS7 版)服务器的 JBoss AS 6.1 服务器。 让我们称另一个为 CLIENT,另一个为 MASTER。
我正在尝试运行一本书(HornetQ Messaging Developers Guide)中的一个简单的 HornetQ 示例,但收到错误消息。我没有使用maven,因为我想坚持使用书中给出的示例。
我使用 SBT 0.13.1 . 当我添加 HornetQ 作为我的依赖项时: libraryDependencies += "org.hornetq" % "hornetq-server" % "2
我发现在我们的实际环境中经常发生以下异常: 2013-01-08 00:09:45,886 ERROR [org.jboss.aspects.tx.TxPolicy] (Thread-70534 (H
我在带有 hornetQ 的 ubuntu 上使用 jboss AS 6 Final 我使用管理面板在名为 Message Buffer Queue 的服务器上创建了一个新队列。 我收到以下错误: U
我正在使用 HornetQ 发送电子邮件。 文件附件使用对象存储系统进行带外传输(不作为消息的一部分)。这会增加一些开销,我想通过将小文件直接放入消息属性来避免这些开销。 我知道我可以发送巨大的消息体
我已阅读 HornetQ 常见问题解答,但找不到任何相关内容。我正在使用 HornetQ 2.2.5,它包含一个错误(是的,只有一个;)。根据这篇文章https://community.jboss.o
我已经配置了hornetq来处理大消息,但是如果客户端没有启动,大消息目录就会变得太大,消耗整个磁盘空间 请帮助弄清楚如何在邮件发送后删除或清理大型邮件文件夹? 也未在 jboss/server/de
我在独立模式下使用默认配置运行 hornetQ,我可以从本地系统连接到它,如果我想从另一个系统连接,必须更改哪些配置才能实现?! 最佳答案 您首先需要定义另一个系统的含义,您是指另一个 HornetQ
对于当前的项目,我尝试使用 JBoss 7.1 和 HornetQ (JMS) 设置以下场景,我认为这是一个相当常见的用例:有三个应用程序服务器。多个MDB应各自处理一个冗长计算过程的分解片段,任务应
我正在尝试独立运行 HornetQ 服务器。但我不知道该怎么做,我下载了 hornetq-2.0.0.GA 并使用 build.sh 启动服务器,但我希望通过 java 代码启动 HornetQ 服务
我想以某种方式延迟整个消息组的消息。 问题是,属于每个消息组的所有消息都必须按照它们发布的顺序进行处理。如果其中一条消息无法被使用 - 我们希望延迟它并延迟同一消息组中的其余消息。我不想阻止消费者 -
我使用 HornetQ 作为队列提供程序,因为它具有持久性功能。但是,在我重新启动应用程序后,队列中的所有消息都丢失了。可能是配置问题? 代码如下: // Step 1. Create the Con
我使用 EJB 来实现命令模式。 EJB 是执行业务逻辑的命令服务。我知道在 J2EE 中 EJB 管理事务以及事务超时。
我正在开发一个使用 HornetQ 作为消息传递服务器的应用程序。在 HornetQ 启动时,我总是收到与 HornetQ live lock 相关的错误。 我针对这个特定问题进行了研究,但无法得出相
我正在尝试将 ActiveMQ-CPP 与 HornetQ 一起使用。我正在使用 ActiveMQ-CPP 捆绑示例,但我很难使用它。生产者工作得很好,但消费者给我以下信息: * BEGIN SERV
我是一名优秀的程序员,十分优秀!