我使用spring集成组件连接我的流程。
我有什么选择?
感谢你的帮助。
更新-2
这是我的密码。
<bean id="myListener" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="destination" ref="requestQueue"/>
<property name="concurrentConsumers" value="5"/>
<property name="maxConcurrentConsumers" value="10"/>
<property name="connectionFactory" ref="connectionFactory"/>
<property name="taskExecutor" ref="threadPoolTaskExecutor"/>
<property name="sessionTransacted" value="true"/>
</bean>
<bean id="threadPoolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="10" />
<property name="maxPoolSize" value="50" />
<property name="queueCapacity" value="10" />
<property name="waitForTasksToCompleteOnShutdown" value="false"/>
</bean>
<!-- Channel where service activator drops message to -->
<si:channel id="jmsOutChannel" />
<!-- This bean code calls DB to get some data and build a report/-->
<bean id="simpleExecutor" class="com.poc.reports.executors.SimpleCode"/>
<!-- Initialize service activator -->
<si:service-activator id="activator" input-channel="jmsInChannel"
ref="simpleExecutor" method="execute" output-channel="jmsOutChannel">
</si:service-activator>
<!-- outbound adaptor for response Queue -->
<jms:outbound-channel-adapter id="jmsout"
channel="jmsOutChannel" destination="responseQueue" />感谢你的回应。谢谢。
Update -3-当与适配器一起使用时,在executor服务中维护事务非常完美。
在我的用例中,重新启动组件是杀死线程的唯一方法吗?
谢谢你的建议。
发布于 2014-11-13 21:45:23
您可以注入一个TaskExcecutor并将其waitForTasksToCompleteOnShutdown设置为false;这将导致它的shutdown()方法在调用底层ExecutorService时调用shutdownNow() (或注入ExecutorService并直接调用其shutdownNow()方法)。
这将取消(尝试中断)活动线程。
但是,如果您的服务正在做一些不可中断的事情,比如.
synchronize(foo) {}
lock.lock()从套接字读取...or等。
https://stackoverflow.com/questions/26918103
复制相似问题