The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Don Stadler (74) [Avatar] Offline
#1
The chapter 9 Mule system worked except when I gave it perverted input, but I didn't expect it to be bulletproof.

When I ran the chapter 9 Servicemix example the test failed because the restaurant response was null:


Welcome to our restaurant table reservation application
Please provide your guest name?
don
Please provide your room number?
11
How many persons can we include in your reservation?
1
And which time can we set for your reservation? (hh:mm)
13:00
inquiry <processInquiry><RestaurantInquiry xmlns="http://message.service.restaurant.chapter9.esb"><guestName>don</guestName><persons>1</persons><reservationTime>2008-12-18T13:00:06</reservationTime><roomNumber>11</roomNumber></RestaurantInquiry></processInquiry>
sending restaurant inquiry message
receiving restaurant response message 1 null

Message was edited by:
Don Stadler

Message was edited by:
Don Stadler
Don Stadler (74) [Avatar] Offline
#2
Re: Chapter 9 Servicemix restaurant request failing
I decided to try to work out why the null response, so I modified the ReplyToConsumerMarshaler.populateMessage() method to:

System.err.println("populateMessage(): " + message.toString());

The test then passed, but the Servicemix trace shows an exception, possibly a timeout exception? I also ran it with the test client twice, and both time it returned a timeout I think. So it's kind of working now.

Welcome to our restaurant table reservation application
Please provide your guest name?
don
Please provide your room number?
111
How many persons can we include in your reservation?
3
And which time can we set for your reservation? (hh:mm)
10:31
inquiry <processInquiry><RestaurantInquiry xmlns="http://message.service.restaurant.chapter9.esb"><guestName>don</guestName><persons>3</persons><reservationTime>2008-12-18T10:31:37</reservationTime><roomNumber>111</roomNumber></RestaurantInquiry></processInquiry>
sending restaurant inquiry message
receiving restaurant response message 1 <processInquiryResponse xmlns="http://esbinaction.com/restaurant"><out reservationID="8" xmlns="http://esbinaction.com/restaurant"><inquiry xmlns="http://message.service.restaurant.chapter9.esb"><guestName>don</guestName><persons>1</persons><reservationTime>2008-12-18T13:00:06Z</reservationTime><roomNumber>11</roomNumber></inquiry><response xmlns="http://message.service.restaurant.chapter9.esb">The Lakeview has a table available with lake view</response><restaurant xmlns="http://message.service.restaurant.chapter9.esb">Lakeview</restaurant><tableAvailable xmlns="http://message.service.restaurant.chapter9.esb">true</tableAvailable></out></processInquiryResponse>
receiving restaurant response message 2 <processInquiryResponse xmlns="http://esbinaction.com/restaurant"><out reservationID="9" xmlns="http://esbinaction.com/restaurant"><inquiry xmlns="http://message.service.restaurant.chapter9.esb"><guestName>don</guestName><persons>1</persons><reservationTime>2008-12-18T13:00:06Z</reservationTime><roomNumber>11</roomNumber></inquiry><response xmlns="http://message.service.restaurant.chapter9.esb">The Yokohama restaurant has a table available for you</response><restaurant xmlns="http://message.service.restaurant.chapter9.esb">Yokohama</restaurant><tableAvailable xmlns="http://message.service.restaurant.chapter9.esb">true</tableAvailable></out></processInquiryResponse>
receiving restaurant response message 3 <processInquiryResponse xmlns="http://esbinaction.com/restaurant"><out reservationID="2" xmlns="http://esbinaction.com/restaurant"><inquiry xmlns="http://message.service.restaurant.chapter9.esb"><guestName>don</guestName><persons>1</persons><reservationTime>2008-12-18T09:09:27Z</reservationTime><roomNumber>1</roomNumber></inquiry><response xmlns="http://message.service.restaurant.chapter9.esb">The Royal Duck has a table with duck available for you</response><restaurant xmlns="http://message.service.restaurant.chapter9.esb">The Royal Duck</restaurant><tableAvailable xmlns="http://message.service.restaurant.chapter9.esb">true</tableAvailable></out></processInquiryResponse>
1. Lakeview with response The Lakeview has a table available with lake view
2. Yokohama with response The Yokohama restaurant has a table available for you
3. The Royal Duck with response The Royal Duck has a table with duck available for you
Please provide your choice to confirm
1
you chose restaurant Lakeview
received object <processInquiryResponse xmlns="http://esbinaction.com/restaurant"><out reservationID="1" xmlns="http://esbinaction.com/restaurant"><inquiry xmlns="http://message.service.restaurant.chapter9.esb"><guestName>don</guestName><persons>1</persons><reservationTime>2008-12-18T09:09:27Z</reservationTime><roomNumber>1</roomNumber></inquiry><response xmlns="http://message.service.restaurant.chapter9.esb">The Lakeview has a table available with lake view</response><restaurant xmlns="http://message.service.restaurant.chapter9.esb">Lakeview</restaurant><tableAvailable xmlns="http://message.service.restaurant.chapter9.esb">true</tableAvailable></out></processInquiryResponse>


But, the Servicemix trace throws an exception:

[java] populateMessage(): ActiveMQTextMessage {commandId = 11, responseRequ
ired = true, messageId = IDsmilieon-PC-63465-1229565142455-0:0:1:2:1, originalDestin
ation = null, originalTransactionId = null, producerId = IDsmilieon-PC-63465-1229565
142455-0:0:1:2, destination = queue://reservation.confirmation, transactionId =
null, expiration = 0, timestamp = 1229565162974, arrival = 0, correlationId = nu
ll, replyTo = queue://lcdtv129.reponse, persistent = true, type = null, priority
= 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = f
alse, userID = null, content = org.apache.activemq.util.ByteSequence@1ae5647, ma
rshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0
, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable =
false, text = null}
[java] payload <restaurant reservationID="8">Lakeview</restaurant>
[java] ERROR - DeadLetterChannel - On delivery attempt: 0 caug
ht: esb.chapter9.restaurant.routing.camel.exception.ExpirationException: reserva
tion could not be found for ID 8
[java] esb.chapter9.restaurant.routing.camel.exception.ExpirationException:
reservation could not be found for ID 8
[java] at esb.chapter9.restaurant.routing.camel.ExpirationCheckProcesso
r.process(ExpirationCheckProcessor.java:43)
[java] at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$P
rocessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
[java] at org.apache.camel.processor.DeadLetterChannel.process(DeadLett
erChannel.java:136)
[java] at org.apache.camel.processor.DeadLetterChannel.process(DeadLett
erChannel.java:86)
[java] at org.apache.camel.processor.Pipeline.process(Pipeline.java:103
)
[java] at org.apache.camel.processor.Pipeline.process(Pipeline.java:87)

[java] at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOf
WorkProcessor.java:40)
[java] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProce
ssorHelper.java:44)
[java] at org.apache.camel.processor.DelegateAsyncProcessor.process(Del
egateAsyncProcessor.java:6smilie
[java] at org.apache.servicemix.camel.CamelJbiEndpoint.processInOnly(Ca
melJbiEndpoint.java:64)
[java] at org.apache.servicemix.common.endpoints.ProviderEndpoint.proce
ss(ProviderEndpoint.java:100)
[java] at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(Asy
ncBaseLifeCycle.java:53smilie
[java] at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchan
ge(AsyncBaseLifeCycle.java:490)
[java] at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(
BaseLifeCycle.java:46)
[java] at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.proce
ssInBound(DeliveryChannelImpl.java:610)
[java] at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(Abs
tractFlow.java:170)
[java] at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(Se
daFlow.java:167)
[java] at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQ
ueue.java:134)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Thread
PoolExecutor.java:885)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPool
Executor.java:907)
[java] at java.lang.Thread.run(Thread.java:619)
Don Stadler (74) [Avatar] Offline
#3
Now it's working....
I just comnmented out the printerr I put in last post, redeployed, and ran the test. Test passed and no trouble on the Servicemix trace this time. So I guess it passed.