I realized that in about 70% our use cases we need a certain combination of spring integration components/handlers (e.g amp gateway, xml or jason transformer, a payload type router and few service activators).
So, instead of wiring up these exact series of components for all my use cases, I am interested in developing a custom component or namespace handler so that we can use this out-of-box for all our use cases.
<int-amqp:inbound-gateway request-channel="inputChannel" queue-names="someQName" />
<int:chain id="xml2Obj" input-channel="inputChannel" output-channel="servicesChannel" >
<int-xml:unmarshalling-transformer unmarshaller="jaxbMarshaller" />
<int:mapping type="org.me.Type1" channel="service1Channel" />
<int:mapping type="org.me.Type2" channel="service2Channel" />
<int:mapping type="org.me.Type3" channel="service3Channel" />
<int:service-activator id="service1" input-channel="service1Channel" ref="serviceImpl" method="serviceMethod1" output-channel="serviceOutChannel" />
<int:service-activator id="service2" input-channel="service2Channel" ref="serviceImpl" method="serviceMethod2" output-channel="serviceOutChannel"/>
<int:service-activator id="service3" input-channel="service3Channel" ref="serviceImpl" method="serviceMethod3" output-channel="serviceOutChannel"/>
Some thing like
behind the scene, i want to retrieve messages from amp broker, transform the payload (say xml to java objects), route the message to appropriate method based on payload type.
<int-myService:serviceActivator bean ="someBeanWhichProvidesImplementation" amqp-Q="someAmqpQueueName" methods="m1,m2,m3,m4,m5" />
But i am not sure how to come up with such a coarse grained message handler, which internally employee these component to serve requests.
The idea of using such a component is, this is the exact set of steps we need to do 60% to 70% of the time, and don't want to configure this every time for various use cases.
I can of course do this with help of a velocity template but my idea is to come up with a custom message handler for this pattern.
Can you please guide on how i should be going about this?