2012-12-03 17 views
5

मैं वसंत एकीकरण के लिए नया हूँ। मेरे पास नीचे कॉन्फ़िगरेशन फ़ाइल में कुछ चैनल कॉन्फ़िगर किए गए हैं।वसंत एकीकरण संदेश हैंडलर श्रृंखला उपयोग?

<int:channel id="channelOne" /> 
<int:channel id="channelTwo" /> 
<int:channel id="channelThree" /> 

मैं इस परिदृश्य में MessageHandlerChain (http://static.springsource.org/spring-integration/docs/2.0.0.RC1/reference/html/chain.html) का उपयोग कर सकते हैं?

धन्यवाद!

+1

आम तौर पर की उपयोगिता को समझने के लिए, आप 2 chann है एल्स परिभाषित, एक इनपुट और आउटपुट चैनल। क्या आप आगे की व्याख्या कर सकते हैं कि आप क्या करने की कोशिश कर रहे हैं ... – tjg184

+0

@ tjg184, मेरे पास एक इनपुट चैनल और आउटपुट चैनल है लेकिन इनपुट और आउटपुट चैनल के बीच एक और चैनल (चैनल दो) है जो कुछ प्रकार की सत्यापन करता है। क्या मैं इस परिदृश्य में संदेश हैंडलर श्रृंखला का उपयोग कर सकता हूं – user1016403

उत्तर

3

मैं चैनल इंटरसेप्टर (http://static.springsource.org/spring-integration/docs/latest-ga/reference/htmlsingle/#channel-interceptors) पर एक नज़र डालेगा। ये आपको आपके इनपुट चैनल को मारने वाले संदेश से पहले कुछ करने की अनुमति देगा, जो मुझे लगता है कि चैनलऑन है। आप अपने उपयोग के मामले के आधार पर एक संदेश लॉग या अपवाद फेंक सकते हैं।

<channel id="channelOne"> 
    <interceptors> 
     <ref bean="yourValidatingInterceptor"/> 
    </interceptors> 
</channel> 

<beans:bean id="yourValidatingInterceptor" class="com.yourcompany.YourValidatingInterceptor"/> 
+0

वर्तमान रिलीज 2.2.0 है: http://static.springsource.org/spring-integration/docs/2.2.0.RELEASE/reference/htmlsingle/#channel-interceptors, लेकिन यह 'नवीनतम-जी' लिंक का उपयोग करना बेहतर है: http://static.springsource.org/spring-integration/docs/latest-ga/reference/htmlsingle/#channel-interceptors –

+0

@GaryRussell धन्यवाद गैरी। – tjg184

10

एक श्रृंखला के लिए एक सुविधा विन्यास सरल करने के लिए है, जब अंतिम बिंदुओं प्रत्यक्ष चैनलों से जुड़े हुए हैं:

<int:channel id="foo1"/> 

<int:service-activator input-channel="foo1" output-channel="foo2" ref="s1" /> 

<int:channel id="foo2"/> 

<int:service-activator input-channel="foo2" output-channel="foo3" ref="s2/> 

<int:channel id="foo3"/> 

<int:service-activator input-channel="foo3" output-channel="foo4" ref="s3" /> 

<int:channel id="foo4"/> 

के बजाय आप उपयोग कर सकते हैं

<int:channel id="foo1"/> 

<int:chain input-channel="foo1" output-channel="foo4">  
    <int:service-activator ref="s1" /> 
    <int:service-activator ref="s2" /> 
    <int:service-activator ref="s3" /> 
</int:chain> 

<int:channel id="foo4"/> 

कृपया current documentation का उपयोग ।

1

हम संदेश हैंडलर चेन का उपयोग करते हैं संचालकों का एक सेट एक रैखिक फैशन में जुड़े होने की जरूरत है।

<int:chain input-channel="marketDataInputChannel"> 
    <int:splitter ref="marketDataSplitter"/> 
    <int:service-activator ref="marketFieldServiceActivator"/> 
    <int:aggregator ref="marketDataAggregator"/> 
    <int:service-activator ref="marketItemServiceActivator"/> 
</int:chain> 
ऊपर के उदाहरण में

, चैनल स्प्लिटर के उत्पादन डेटा इनपुट सेवा-उत्प्रेरक की और सेवा-उत्प्रेरक के उत्पादन में हो इनपुट एग्रीगेटर की हो जाएगा होगा .. ।
मुझे आशा है कि इस स्पष्टीकरण मदद आप <int:chain />

+0

आपके पास इस श्रृंखला के लिए आउटपुट-चैनल परिभाषित नहीं है ... मैंने इसे अन्य स्थानों पर देखा है और मानना ​​है कि यह कानूनी है, लेकिन आपके "marketItemServiceActivator" का आउटपुट कहां जाता है? – HDave

संबंधित मुद्दे