Home Ask Login Register

Developers Planet

Your answer is one click away!

Insomnium February 2016

Spring integration dsl: http outbound gateway

Faced spring integration java-dsl issue, I'm stuck. This is a code I have for my flow declaration:

    public IntegrationFlow orchestrationFlow() {
        return IntegrationFlows.from(
                .<String, BookingRequest>transform(s -> {
                    Ticket t = new Gson().fromJson(s, Ticket.class);
                    return new BookingRequest()
                // HTTP part goes here
                .<BookingRequest, HttpEntity>transform(HttpEntity::new)
                // and here HTTP part ends

And everything was OK until I utilized HTTP outbound channel adapter. I need to call simple RESTful interface and code above does it pretty well. But, following Jms.outboundAdapter(responseDestinationTemplate()) line leads to nothing, no action performes after successfull http call.

If I remove http flow part (surrounded by comments) - it works. Implemented so much stuff, almost understood and saw beauty and simplicity of integration ...aand this is it. Yet another p


Artem Bilan February 2016

Spring Integration provides two MessageHandler types: one-way - just handle message and stop. And another one is like: handle request message and produce reply to the output channel.

The first one is called like outboundChannelAdapter and with your HTTP case you just only send a POST request and don't worry about the reply.

Since the message flow is stopped on the outboundChannelAdapter no any further action is possible in the integration chain. Like in your case the next Jms.outboundAdapter won't be reached.

If you really expect the reply from your REST service you should use Http.outboundGateway instead. And your BookStatus will be sent to the JMS as you'd like by your last .handle() in the flow.

Post Status

Asked in February 2016
Viewed 1,824 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life