Spring Integration message channel hangs even if time out exceeds

My integration context is as follows :

<int:channel id="fileInboundChannelAdapter"/>
<int-file:inbound-channel-adapter directory="${directory}" channel="fileInboundChannelAdapter" auto-startup="false" >
    <int:poller fixed-rate="5000" max-messages-per-poll="1" />
</int-file:inbound-channel-adapter>

And I am manually triggering this channel after some condition is met:

@Resource(name = "fileInboundChannelAdapter")
private MessageChannel messageChannel;

Inside some method

Message<File> fileMessage = MessageBuilder.withPayload(fileObject).build();
boolean success = messageChannel.send(fileMessage, 1000 * 60);

At this line, the messageChannel.send doesnot respond even after the time out exceeds and no other request is served, And needs to restart the server.

Upvotes: 3

Views: 410

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

You must share a subscriber for that fileInboundChannelAdapter. Having that we will try to understand what's going on. And take a look to logs to figure the issue from your side.

timeout param (1000 * 60 in your case) doesn't have value for the DirectChannel:

protected boolean doSend(Message<?> message, long timeout) {
    try {
        return this.getRequiredDispatcher().dispatch(message);
    }
    catch (MessageDispatchingException e) {
        String description = e.getMessage() + " for channel '" + this.getFullChannelName() + "'.";
        throw new MessageDeliveryException(message, description, e);
    }
}

So, it looks like your subscriber just blocks the calling thread somehow... Need to see its code.

Upvotes: 1

Related Questions