Spring Integration message channel hangs even if timeout exceeds
My integration context looks like this:
<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 start this channel manually 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);
On this line, messageChannel.send is not responding even after timeout and no other request is being served and needs to restart the server.
source to share
You have to share subscriber
for this fileInboundChannelAdapter
. With this in mind, we will try to understand what is going on. And take a look at the logs to get a sense of the problem from your side.
timeout
param ( 1000 * 60
in your case) doesn't matter for 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 yours subscriber
is blocking the calling thread somehow ... You need to see its code.
source to share