I have the following bean:
@Bean
public MessageProducer sqsMessageAdapter() {
SqsMessageDrivenChannelAdapter adapter = new SqsMessageDrivenChannelAdapter(this.amazonSqs, awsConfiguration.myQueue.get());
adapter.setAutoStartup(true);
adapter.setMaxNumberOfMessages(1);
adapter.setSendTimeout(2000);
adapter.setVisibilityTimeout(200);
adapter.setWaitTimeOut(20);
adapter.setOutputChannel(this.myOutput);
return adapter;
}
MORE INFO: I am trying to find a way of stopping/starting the polling on command, i'm doing this using annotations without xml.
Currently I am using the SqsMessageDrivenChannelAdapter
and calling the stop method, followed by the start when I want to restart the channel adapter. The problem I am having is that a timeout exception gets thrown in the stop method regardless of timeout settings. This happens on the future.get()
call (line 197 of SimpleMessageListenerContainer
) I think this is causing start not to work. Start does not throw any exceptions but the poller does not pick up any new messages
UPDATE:
The start and stop commands seem to be working correctly. The problem seems to be that I cannot set the property:
public void setQueueStopTimeout(long queueStopTimeout) {
this.queueStopTimeout = queueStopTimeout;
}
This lives with SimpleMessageListenerContainer.java
from SqsMessageDrivenChannelAdapter.java
without this I am getting timeouts as the default is not long enough.