Java Reference
In-Depth Information
It just doesn't get any cleaner than that! No Spring Integration interfaces whatsoever. You make a
request, searching is done, and you get the result back when the processing is done.
The service implementation for this setup is interesting, not because of what you've added, but
because of what's not there:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans
xmlns:beans="
http://www.springframework.org/schema/beans"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="
http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
➥
<beans:import resource="solution041.xml" />
<context:annotation-config />
<channel id="inboundHotelReservationSearchChannel" />
<channel id="outboundHotelReservationSearchResultsChannel" />
<beans:bean id="vacationServiceImpl" .
➥
class="com.apress.springenterpriserecipes.springintegration.
➥
myholiday.VacationServiceImpl" />
<jms:inbound-gateway
request-channel="inboundHotelReservationSearchChannel"
request-destination-name="inboundHotelReservationSearchDestination"
connection-factory="connectionFactory" />
<service-activator
input-channel="inboundHotelReservationSearchChannel"
ref="vacationServiceImpl"
method="findHotels" />
</beans:beans>
Here you've defined an inbound JMS gateway
element
. The messages from the inbound JMS
gateway are put on a channel,
inboundHotelReservationSearchChannel
, whose messages are forwarded
to a
service-activator
, as you would expect. The
service-activator
is what handles actual processing.
What's interesting here is that there's no mention of a response channel, for either the
service-
activator
, or for the inbound JMS gateway. The
service-activator
looks, and fails to find, an
reply channel and so uses the reply channel created by the inbound JMS gateway, which in turn has
created the reply channel based on the header metadata in the inbound JMS message. Thus, everything
just works.
Search WWH ::
Custom Search