Remoting version of CafeDemo
Hi,
I have been trying to make a remoting version of DafeDemo, using RMI for the transport.
I put the Barista in one module called the "server" and the rest in another module called the "client", except for Drink and DrinkType that goes in a "common" module.
Here is the configuration for the server:
Code:
<integration:message-bus/>
<integration:channel id="coldDrinks"/>
<integration:channel id="hotDrinks"/>
<integration:rmi-gateway id="rmiSourceColdDrinks" request-channel="coldDrinks"/>
<integration:rmi-gateway id="rmiSourceHotDrinks" request-channel="hotDrinks"/>
<integration:service-activator input-channel="coldDrinks" ref="barista" method="prepareColdDrink"/>
<integration:service-activator input-channel="hotDrinks" ref="barista" method="prepareHotDrink"/>
<bean name="barista" class="integration.samples.cafe.server.Barista"/>
and her is the configuration for the client:
Code:
<message-bus/>
<channel id="orders"/>
<channel id="drinks"/>
<channel id="coldDrinks"/>
<channel id="hotDrinks"/>
<rmi-handler id="rmiTargetColdDrinks" remote-channel="coldDrinks" host="localhost" />
<rmi-handler id="rmiTargetHotDrinks" remote-channel="hotDrinks" host="localhost"/>
<beans:bean id="drinkRouter" class="integration.samples.cafe.client.DrinkRouter"/>
<router input-channel="drinks" ref="drinkRouter" method="resolveDrinkChannel" />
<beans:bean id="orderSplitter" class="integration.samples.cafe.client.OrderSplitter"/>
<splitter input-channel="orders" output-channel="drinks" ref="orderSplitter" method="split"/>
<service-activator input-channel="coldDrinks" ref="rmiTargetColdDrinks"/>
<service-activator input-channel="hotDrinks" ref="rmiTargetHotDrinks"/>
<beans:bean id="cafe" class="integration.samples.cafe.client.Cafe">
<beans:property name="orderChannel" ref="orders"/>
</beans:bean>
and here is the display from the server:
Code:
INFO: message bus started
message-bus-2 prepared cold drink #1: iced 3 shot MOCHA
message-bus-1 prepared hot drink #1: hot 2 shot LATTE
Then, the server seems to be sleeping, while the client has splitted and routed all messages. Only if I stop the server, the client will try sending the other messages and get an error since the server is down.
Does anyone knows why the server is blocking on each channel and how to avoid this?
Thanks!