java - Spring integration dsl: http outbound gateway -
faced spring integration java-dsl issue, i'm stuck. code have flow declaration:
@bean public integrationflow orchestrationflow() { return integrationflows.from( jms.messagedrivenchanneladapter(queueconnectionfactory()) .destination(bookingqueue()) .outputchannel(bookingchannel())) .<string, bookingrequest>transform(s -> { ticket t = new gson().fromjson(s, ticket.class); return new bookingrequest() .setmovieid(t.getmovie().getid()) .setrow(t.getseat().getrow()) .setseat(t.getseat().getnumber()) .setscreennumber(t.getscreennumber() ); }) // http part goes here .<bookingrequest, httpentity>transform(httpentity::new) .handle( http.outboundchanneladapter(bookingserverurl) .httpmethod(httpmethod.post) .extractpayload(true) .expectedresponsetype(bookstatus.class) ) // , here http part ends .handle( jms.outboundadapter(responsedestinationtemplate()) ) .get(); } and ok until utilized http outbound channel adapter. need call simple restful interface , code above pretty well. but, following jms.outboundadapter(responsedestinationtemplate()) line leads nothing, no action performes after successfull http call.
if remove http flow part (surrounded comments) - works. implemented stuff, understood , saw beauty , simplicity of integration ...aand it. yet place got stuck in.
and here log after success rest call:
2016-02-08 21:01:22.155 debug 18209 --- [enercontainer-1] o.s.web.client.resttemplate : post request "http://localhost:9052/api/book" resulted in 200 (ok) 2016-02-08 21:01:22.156 debug 18209 --- [enercontainer-1] o.s.web.client.resttemplate : reading [class c.e.m.integration.domain.bookstatus] "application/json;charset=utf-8" using [org.springframework.http.converter.json.mappingjackson2httpmessageconverter@6b9469bd] 2016-02-08 21:01:22.168 debug 18209 --- [enercontainer-1] i.h.o.httprequestexecutingmessagehandler : handler 'org.springframework.integration.http.outbound.httprequestexecutingmessagehandler#0' produced no reply request message: genericmessage [payload=<bookingrequest(movieid=0, row=1, seat=1, screennumber=1),{}>, headers={jms_redelivered=false, jms_replyto=queue://statuschannel, jms_correlationid=5021291a-d4d5-47ca-b591-b6f311378688, correlationid=1d41f05a-3695-4adb-87b0-d75c17bbc3ad, id=a1fb2a2f-5d78-3183-d409-3f60aae74a20, priority=4, jms_timestamp=1454950877264, jms_messageid=id:ins-laptop-31198-1454948247657-1:9:1:1:1, timestamp=1454950877352}] 2016-02-08 21:01:22.168 debug 18209 --- [enercontainer-1] o.s.integration.channel.directchannel : postsend (sent=true) on channel 'inboundflow.channel#2', message: genericmessage [payload=<bookingrequest(movieid=0, row=1, seat=1, screennumber=1),{}>, headers={jms_redelivered=false, jms_replyto=queue://statuschannel, jms_correlationid=5021291a-d4d5-47ca-b591-b6f311378688, correlationid=1d41f05a-3695-4adb-87b0-d75c17bbc3ad, id=a1fb2a2f-5d78-3183-d409-3f60aae74a20, priority=4, jms_timestamp=1454950877264, jms_messageid=id:ins-laptop-31198-1454948247657-1:9:1:1:1, timestamp=1454950877352}] 2016-02-08 21:01:22.168 debug 18209 --- [enercontainer-1] o.s.integration.channel.directchannel : postsend (sent=true) on channel 'inboundflow.channel#1', message: genericmessage [payload=bookingrequest(movieid=0, row=1, seat=1, screennumber=1), headers={jms_redelivered=false, jms_replyto=queue://statuschannel, jms_correlationid=5021291a-d4d5-47ca-b591-b6f311378688, correlationid=1d41f05a-3695-4adb-87b0-d75c17bbc3ad, id=859af23d-214f-4400-e9cb-7d40308755cd, priority=4, jms_timestamp=1454950877264, jms_messageid=id:ins-laptop-31198-1454948247657-1:9:1:1:1, timestamp=1454950877350}] 2016-02-08 21:01:22.168 debug 18209 --- [enercontainer-1] o.s.integration.channel.directchannel : postsend (sent=true) on channel 'inboundflow.channel#0', message: genericmessage [payload={"screennumber":1,"seat":{"row":1,"number":1},"movie":{"id":0,"name":"the matrix"}}, headers={jms_redelivered=false, jms_replyto=queue://statuschannel, jms_correlationid=5021291a-d4d5-47ca-b591-b6f311378688, correlationid=1d41f05a-3695-4adb-87b0-d75c17bbc3ad, id=636638ed-aec2-082e-6181-0484999fd807, priority=4, jms_timestamp=1454950877264, jms_messageid=id:ins-laptop-31198-1454948247657-1:9:1:1:1, timestamp=1454950877331}] no errors, no warnings @ all.
spring integration provides 2 messagehandler types: one-way - handle message , stop. , 1 like: handle request message , produce reply output channel.
the first 1 called outboundchanneladapter , http case send post request , don't worry reply.
since message flow stopped on outboundchanneladapter no further action possible in integration chain. in case next jms.outboundadapter won't reached.
if expect reply rest service should use http.outboundgateway instead. , bookstatus sent jms you'd last .handle() in flow.
Comments
Post a Comment