简体   繁体   中英

Are Spring Integration Queue Channel Multithreaded

I am trying to understand whether multiple threads can concurrently/parallelly messages from Spring Integration Queue Channel. Suppose I have the following configuration :

<int:channel id="fooChannel">
   <int:queue />
 </int:channel>

From the documentation, I understand that by using a Queue Channel producer and consumer get decoupled and both happen in different threads.

My point of confusion is - Is there a way that Multiple threads can work on the messages stored in the queue channel. Something that we regularly do with JMS channels. (one/multiple producer & multiple consumer)

If it is not possible what is the recommended way to achieve concurrent processing of the messages in a queue channel

The QueueChannel is backed by the java.util.Queue (the LinkedBlockingQueue by default), which is designed for multi-threaded interaction.

So, you definitely can send message to this channel from different threads. And on the other hand it is also true: this channel works exactly as JMS queue: you can have several competitive consumers ( PollingConsumer endpoints) and only one of them will poll and process a message from the queue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM