Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 608
anish krishna manandhar Avatar asked Nov 26 '25 16:11

anish krishna manandhar


1 Answers

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.

like image 168
Artem Bilan Avatar answered Dec 01 '25 05:12

Artem Bilan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!