1
我有以下彈簧集成配置v1.0.4。Spring集成 - 入站通道適配器多線程?
<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:[email protected]: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
}
}
問:
- 它是多線程?或電子郵件將以串行方式處理?如果是,那麼如何使它成爲多線程?
- 當我的應用程序在Eclipse中調試模式下運行,我可以看到一些定時器任務線程,但每個請求將相同的計時器任務以連續的方式,也是我的線程數(定時任務)也在穩步增長。我可能會誤解它。
如果我錯了,請糾正我。
謝謝你的建議,我以前沒有使用過排隊通道,我想就像你提到的,但我得到了以下異常。 '線程中的異常「main」org.springframework.beans.factory.BeanCreationException:創建名爲'org.springframework.integration.config.ConsumerEndpointFactoryBean#0'的bean時出錯:init方法的調用失敗;嵌套的異常是java.lang.IllegalArgumentException:沒有爲端點'org.springframework.integration.config.ConsumerEndpointFactoryBean#0'定義輪詢器,並且上下文中沒有默認的輪詢器。 – Mahendran