In my Code, SqsMessageDrivenChannelAdapter channel adapter configured to read message from AWS queue and push to a pollable channel(Queue). To the pollable channel,a service activator is pointing to poll message and process.
My Exact question: How to make work service activator as multithreaded to poll message from pollable channel and do some parallel task by specified thread size.
Channel Adapter:
@Bean
public MessageProducer sqsMessageDrivenChannelAdapterForFlights() {
log.info("**** start listening to: " + ttFlightsXMLSqsName + " **** ");
SqsMessageDrivenChannelAdapter adapter =
new SqsMessageDrivenChannelAdapter(amazonSqs, ttFlightsXMLSqsName);
adapter.setOutputChannelName(MessageChannelConstants.get_tt_flights);
adapter.setMaxNumberOfMessages(5);
return adapter;
}
Pollable Channel:
@Bean(name = MessageChannelConstants.get_tt_flights)
public PollableChannel sqsInputChannelFlights() {
return new QueueChannel();
}
Service activator:
@ServiceActivator(inputChannel = MessageChannelConstants.get_tt_flights,
poller = @Poller(fixedRate = "5000"))
public void processFlightData(Message<?> receive) throws PacPlusException {
.................
long startTime = System.currentTimeMillis();
}
Final question: If I make two service activator pointing to the same pollable channel will it work perfectly and is it good to use kind of parallel message process?