[英]Is Spring integration - inbound channel adapter multithreaded?
我具有以下spring-integration配置v1.0.4。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mail="http://www.springframework.org/schema/integration/mail"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/integration/mail
http://www.springframework.org/schema/integration/mail/spring-integration-mail-2.1.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<util:properties id="javaMailProperties">
<prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
<prop key="mail.imap.socketFactory.fallback">false</prop>
<prop key="mail.store.protocol">imaps</prop>
<prop key="mail.debug">false</prop>
</util:properties>
<mail:inbound-channel-adapter id="imapAdapter"
store-uri="imaps://user:pass@domain:993/inbox"
channel="recieveEmailChannel"
auto-startup="true"
java-mail-properties="javaMailProperties">
<int:poller>
<int:interval-trigger initial-delay="1000" interval="2000"
fixed-rate="true"/>
</int:poller>
</mail:inbound-channel-adapter>
<int:channel id="recieveEmailChannel">
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:logging-channel-adapter id="logger" level="DEBUG"/>
<int:service-activator input-channel="recieveEmailChannel" ref="emailReceiverService" method="receive"/>
<bean id="emailReceiverService" class="com.mycompany.DefaultEmailReceiverUtilService">
</bean>
DefaultEmailReceiverUtilService
public class DefaultEmailReceiverUtilService implements
EmailReceiverUtilService
{
public void receive(Message<?> message)
{
//Processing the emails
}
}
題:
如果我錯了,請糾正我。
我認為您需要的是隊列通道。 您的receiveEmailChannel應該類似於:
<int:channel id="recieveEmailChannel">
<int:queue/>
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
我確定您將知道如何定義隊列通道。 當前正在同步的點對點通道,一次只能傳遞1條消息。
當前,如果您要向該通道添加某些內容,它將等待服務激活器完成,而使用隊列通道時,服務激活器應在檢測到隊列中的某些內容時立即觸發新線程。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.