Skip to content

Instantly share code, notes, and snippets.

@christian-posta
Last active December 24, 2015 03:09
Show Gist options
  • Save christian-posta/6735618 to your computer and use it in GitHub Desktop.
Save christian-posta/6735618 to your computer and use it in GitHub Desktop.
<int:gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
<!-- each order has a collection of order items that is split apart to be processed -->
<int:channel id="orders"/>
<int:splitter input-channel="orders" expression="payload.items" output-channel="drinks"/>
<!-- The router sends different drink orders on different paths -->
<int:channel id="drinks"/>
<int:router input-channel="drinks" expression="payload.iced ? 'coldDrinks' : 'hotDrinks'"/>
<!-- individual order items are processed by the barista -->
<int:channel id="coldDrinks">
<int:queue capacity="10"/>
</int:channel>
<int:service-activator input-channel="coldDrinks" ref="barista" method="prepareColdDrink" output-channel="preparedDrinks"/>
<!-- individual order items are processed by the barista -->
<int:channel id="hotDrinks">
<int:queue capacity="10"/>
</int:channel>
<int:service-activator input-channel="hotDrinks" ref="barista" method="prepareHotDrink" output-channel="preparedDrinks"/>
<!-- drink order items are aggregated in a call to the waiter -->
<int:channel id="preparedDrinks"/>
<int:aggregator input-channel="preparedDrinks" method="prepareDelivery" output-channel="deliveries">
<beans:bean class="org.springframework.integration.samples.cafe.xml.Waiter"/>
</int:aggregator>
<int-stream:stdout-channel-adapter id="deliveries"/>
<beans:bean id="barista" class="org.springframework.integration.samples.cafe.xml.Barista"/>
<int:poller id="poller" default="true" fixed-delay="1000"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment