我正在使用 PropertiesFactoryBean 从典型的属性文件加载属性。有没有办法让 Spring 自动修剪 prop 值中的尾随空白?
从Tomcat管理器发出"停止"命令时,我们的系统不会关闭.我已经确定它与ActiveMQ/Spring有关.我甚至想出了如何让它关闭,但我的解决方案是一个黑客(至少我希望这不是"正确"的方式).我想知道关闭ActiveMQ的正确方法,以便我可以删除我的黑客.
我继承了这个组件,我没有关于为什么做出某些架构决策的信息,经过大量的挖掘后我觉得我理解他的想法,但我可能会遗漏一些东西.换句话说,真正的问题可能在于我们尝试使用ActiveMQ/Spring的方式.
我们在ServletContainer(Tomcat 6/7)中运行并使用ActiveMQ 5.9.1和Spring 3.0.0我们的应用程序的多个实例可以在"组"中运行,每个实例都在它自己的服务器上运行.ActiveMQ用于促进多个实例之间的通信.每个实例都有自己的嵌入式代理和它自己的一组队列.每个实例上的每个队列都只有1个org.springframework.jms.listener.DefaultMessageListenerContainer正在监听它,因此例如5个队列= 5个DefaultMessageListenerContainer.
我们的系统正常关闭,直到我们通过向ConnectionFactory添加queuePrefetch ="0"来修复错误.起初我认为这种改变在某种程度上是不正确的,但现在我了解情况,我相信我们不应该使用预取功能.
我创建了一个测试应用程序来复制问题.请注意,以下信息未提及消息生成者.这是因为我可以在不发送/处理单个消息的情况下复制问题.只需在引导期间创建Broker,ConnectionFactory,Queues和Listener就足以防止系统正常停止.
这是我的Spring XML示例配置.如果有人想要,我会很乐意提供我的整个项目:
<amq:broker persistent="false" id="mybroker">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://0.0.0.0:61616"/>
</amq:transportConnectors>
</amq:broker>
<amq:connectionFactory id="ConnectionFactory" brokerURL="vm://localhost?broker.persistent=false" >
<amq:prefetchPolicy>
<amq:prefetchPolicy queuePrefetch="0"/>
</amq:prefetchPolicy>
</amq:connectionFactory>
<amq:queue id="lookup.mdb.queue.cat" physicalName="DogQueue"/>
<amq:queue id="lookup.mdb.queue.dog" physicalName="CatQueue"/>
<amq:queue id="lookup.mdb.queue.fish" physicalName="FishQueue"/>
<bean id="messageListener" class="org.springframework.jms.listener.DefaultMessageListenerContainer" abstract="true">
<property name="connectionFactory" ref="ConnectionFactory"/>
</bean>
<bean parent="messageListener" id="cat">
<property name="destination" ref="lookup.mdb.queue.dog"/>
<property name="messageListener">
<bean class="com.acteksoft.common.remote.jms.WorkerMessageListener"/>
</property>
<property name="concurrentConsumers" value="200"/>
<property name="maxConcurrentConsumers" value="200"/>
</bean>
<bean parent="messageListener" id="dog">
<property name="destination" ref="lookup.mdb.queue.cat"/>
<property name="messageListener">
<bean class="com.acteksoft.common.remote.jms.WorkerMessageListener"/>
</property>
<property name="concurrentConsumers" value="200"/>
<property name="maxConcurrentConsumers" …
Run Code Online (Sandbox Code Playgroud)