We use Spring AMQP to read message from RabbitMQ, right now we only read one message at a time off the queue, is there anyway I can read multiple messages off the queue then process the batch?
I see there is a BatchingStrategy available in Spring, how can i plugin that one into the connectionFactory?
here is my code:
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host, port);
connectionFactory.setUsername(username);
connectionFactory.setPassword(password);
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
JsonMessageConverter converter = new JsonMessageConverter();
DefaultClassMapper defaultClassMapper = new DefaultClassMapper();
defaultClassMapper.setDefaultType(Message.class);
converter.setClassMapper(defaultClassMapper);
factory.setMessageConverter(converter);
factory.setConcurrentConsumers(3);
...
public class Processor implements IChannelProcessor {
@Override
public void process(Message message) {
validateMessageEvent(message);
// process the message