0
我在實現一個緩衝的工作,以執行各種任務。 我正在開發一個基於Spring的項目。 我決定使用Spring集成來實現我的目標。我經歷了一個Cafè示例項目,以瞭解SI如何工作。在Spring集成配置輪詢的隊列
爲了證明Spring集成我實現了一個表,其中我動態插入工作要執行。 此表是「網關」。然後我配置了一個路由器和各種渠道。
我不完全理解的是具有檢查中的「網關」新的就業機會存在於輪詢的元素。 這是正確的嗎?
如果是這樣,我怎麼能配置輪詢? 在此先感謝! 這裏XML代碼:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-feed="http://www.springframework.org/schema/integration/feed"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/stream
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
<int:gateway id="usersToSend" service-interface="it.stasbranger.spidly.rss.UsersToSend" />
<int:channel id="channel" />
<int:channel id="providers"/>
<int:router input-channel="providers" ref="providerRouter" method="resolveProviderChannel"/>
<int:channel id="twitterChannel">
<int:queue capacity="10"/>
</int:channel>
<int:service-activator input-channel="twitterChannel" ref="twitterService" method="updateStatusByProfile"/>
<int:channel id="facebookChannel">
<int:queue capacity="10"/>
</int:channel>
<int:service-activator input-channel="facebookChannel" ref="facebookService" method="updateStatusByProfile"/>
<int:channel id="linkedinChannel">
<int:queue capacity="10"/>
</int:channel>
<int:service-activator input-channel="linkedinChannel" ref="linkedinService" method="writeSlogan2Linkedin"/>
<bean id="twitterService" class="it.social.TwitterService"/>
<bean id="facebookService" class="it.social.FacebookService"/>
<bean id="linkedinService" class="it.social.LinkedinService"/>
<int:poller id="poller" default="true">
</int:poller>
FB
感謝您的提示。 我配置爲你說的一個入站通道適配器,將它鏈接到通道輸入和一個返回Message對象或null的方法。 我並不完成暗示投票人。 如果我在通道適配器標籤中插入「int-poller」元素,則會出現錯誤,因爲沒有定義輪詢器。我該如何解決這個問題? 還有一件事:在輪詢元素中,我設置了「固定費率屬性」,但它以紅色下劃線,因爲它不允許用於該位置。想法? – FrankBr
如果您不添加' '作爲' '的子元素,它將使用您定義的默認輪詢器。該錯誤可能是因爲您的IDE緩存了架構的錯誤版本。如果您正在使用STS,那麼在最近的版本中已經修復了許多這些問題;如果你使用的是舊版本,這裏有一些建議... http://forum.springsource.org/showthread.php?126494-Avoiding-STS-Bogus-Warnings-And-Errors –