Search code examples
springrabbitmqspring-amqpspring-rabbit

Where does spring rabbit consume a message on a new thread


I'm working on tracing rabbitmq, and I've found that spring rabbit consumes a message on a new thread. I wanna know where does it create a new thread


Solution

  • See Choosing a Container.

    The (default) SimpleMessageListenerContainer passes the messages to a dedicated thread for each consumer; the thread(s) are created when the container is start()ed. You can specify a custom TaskExecutor. By default, it uses a SimpleAsyncTaskExecutor.

    The DirectMessageListenerContainer calls the listener on the amqp-client dispatcher thread.