Java Reference
In-Depth Information
<beans:bean id="connectionFactory" class="org.springframework.
<beans:property name="targetConnectionFactory">
<beans:bean class="org.apache.activemq.ActiveMQConnectionFactory">
<beans:property name="brokerURL" value=" tcp://localhost:8753"/>
<beans:property name="sessionCacheSize" value="10"/>
<beans:property name="cacheProducers" value="false"/>
<beans:bean id="inboundHelloWorldJMSPingServiceActivator"
<channel id="inboundHelloJMSMessageChannel"/>
<service-activator input-channel="inboundHelloJMSMessageChannel"
As you can see, the most intimidating part is the schema import! The rest of the code is standard
boilerplate. You define a connectionFactory exactly as if you were configuring a standard MDP.
Then you define the salient beans specific to this solution: first, a bean that responds to messages
coming in to the bus from the message queue, inboundHelloWorldJMSPingServiceActivator . A service-
activator is a generic endpoint in Spring Integration that's used to invoke functionality_whether it be an
operation in a service, or some routine in a regular POJO, or anything you want instead_in response to a
message. Although this will be covered in some detail, it's interesting here only because you are using it
to respond to messages. These beans taken together are the collaborators in the solution, and this
example is fairly representative of how most integrations look: you define your collaborating
components; then you define the configuration using Spring Integration schema that configures the
solution itself.
The configuration starts with the inboundHelloJMSMessageChannel channel, which tells Spring
Integration what to name the point-to-point connection from the message queue to the service-
activator . You typically define a new channel for every point-to-point connection.
Search WWH ::

Custom Search