Martins
Martins

Reputation: 1261

can a jms inbound gateway reply include all messages of a message sequence

I have a jms-inbound-gateway that reads requests from a WebsphereMQ broker and passes them though my integration system which returns a message sequence as reply.

The message sequence is obtained by applying the splitter on a collection. It generates 63 messages as shown in the log.

The problem is that the WebsphereMQ broker only receives the last message. I have no idea where the other 62 messages went.

Is it because the jms-inbound-gateway cannot reply a message sequence?

Upvotes: 0

Views: 221

Answers (1)

Gary Russell
Gary Russell

Reputation: 174769

Correct; a gateway is for simple request/reply scenarios.

However, I would expect the first, not the last message to be the reply.

To return multiple messages for a single reply, you can either aggregate them into a single message, or use a message-driven-channel-adapter for inbound and outbound-channel-adapter for the sequence of "replies".

EDIT:

When a gateway receives multiple responses to a request, the one that is returned depends on the topology of the flow. With a completely synchronous flow (DirectChannels throughout), the last message will be returned. With an asynchronous flow (QueueChannels or ExecutorChannels in the flow), it will most likely be the first, but there is a race condition.

Bottom line is the gateway only expects one reply and sending multiple replies to a single request will not produce the expected behavior.

Upvotes: 2

Related Questions