Originally posted by **arths31** November 6, 2024
Hello,
I'm having an issue when using @RabbitListener with batching enabled.
Batching works fine but I want to receive a list of **org.springframework.amqp.core.Message** and I am receiving a list of **byte[]** instead.
Here is the bean I use to configure the containerFactory
```
@Bean
fun myFactory(configurer: SimpleRabbitListenerContainerFactoryConfigurer): SimpleRabbitListenerContainerFactory {
val factory = SimpleRabbitListenerContainerFactory()
factory.setConnectionFactory(connectionFactory)
factory.setBatchListener(true)
factory.setBatchSize(10)
factory.setConsumerBatchEnabled(true)
factory.setDeBatchingEnabled(false)
factory.setReceiveTimeout(5000)
return factory
}
```
and here is where I expect to receive my messages
```
@RabbitListener(bindings = [
QueueBinding(
value = org.springframework.amqp.rabbit.annotation.Queue(name = "test", durable = "true"),
key = ["xxx.#"],
exchange = Exchange(name = Constants.EVENT_EXCHANGE_NAME, type = ExchangeTypes.TOPIC)
)
], containerFactory = "myFactory")
fun listen(messages: List) {
...
}
```
**messages** returns a list of byte[] which contains my payloads.
I have tried switching to **List>** and even a list of String just like in the following exemple but to no avail : https://docs.spring.io/spring-amqp/reference/amqp/receiving-messages/batch.html
Thank you in advance for your help
Discussed in https://github.com/spring-projects/spring-amqp/discussions/2889