SourceConnector.poll() is synchronized but a message can be picked up for processing and another thread can enter this method and require that fillBuffer() be called.
![mirth connect channel auto queue of errors mirth connect channel auto queue of errors](https://i.stack.imgur.com/WGZfo.png)
Since we depend on the in memory buffer for queued messages there is an inconsistency filling the queue buffer and processing messages that can lead to duplicate messages being processed. Rev 7978 - Found issue with source queue parallelization. If you tried to use an LLP Sender on an unsynchronized channel, you would likely run into all sorts of weird issues. That was not true for other destination connectors though like the LLP Sender. However that really only "worked" for JavaScript Writers, because multiple threads would spin up multiple Rhino contexts anyway, so it was "by accident" thread-safe. However the internal Mule worker thread cap was 10, so at most 10 threads could be running concurrently. In 2.x you could turn off the "Synchronized" option on a channel, and then multiple threads would be able to process asynchronously even at the point of destination dispatch. That's done for preservation of message order, and to ensure that filters/transformers/scripts are thread-safe. In 3.x it's essentially the same, except that the synchronization is done around the entire message lifecycle (basically from the preprocessor to the postprocessor). So multiple threads could process through the preprocessor, source filter/transformer, and destination filter/transformer, but when it came time to send the message, that's when only one thread was allowed. In 2.x, the synchronization was only done at the destination dispatcher. It's just that when it comes time to dispatch a message through the channel, a synchronization block only allows one thread to get in at any given time. It was and still is one thread per connection. should be written appropriately to prevent deadlocks or other problems. So for example if you are using a transformer to call out to a database, you should expect that multiple instances of the same transformer could be doing that at the same time. Scripts for different messages can be running at the same time, and in indeterminate order.With the current structure, if a counter is kept in the global channel map, then it's guaranteed to be accurate across multiple messages. Collisions and overwriting of shared memory (like things stored in the global or global channel maps) could happen across different messages, without appropriate checks.Also, depending on how this is implemented, the overall message ID may not accurately reflect the true order of messages as they were received by the channel. So a message that was received first is not guaranteed to be sent out first, and the associated response is not guaranteed to be sent back to the source first. Obviously certain sacrifices would have to be made: So in essence, this feature would provide some way for multiple messages to process through a channel at the same time. In 2.x, the parallelization part existed when unsynchronizing a channel, but you couldn't actually respond from a destination or custom response.
![mirth connect channel auto queue of errors mirth connect channel auto queue of errors](https://amarnathks.files.wordpress.com/2013/01/source_trans.png)
This can be true for HL7 interfaces as well, particularly for servers that accept QRY messages and return a set of results (immunizations, syndromic surveillance, etc.). Especially for "stateless" Web Service / HTTP Listener channels, requests tend to be mutually exclusive and don't necessarily need to be ordered in any specific way. However, this can severely hamper message throughput for channels that don't actually need message order or any other benefits that the "single message conduit" paradigm might bring.
![mirth connect channel auto queue of errors mirth connect channel auto queue of errors](https://lh3.googleusercontent.com/-OuG-3oIB1iw/VwIf-UZ8mdI/AAAAAAAAAbc/HyzWW8ih0Tk/s72-c/clip_image001_thumb.png)
#MIRTH CONNECT CHANNEL AUTO QUEUE OF ERRORS SERIAL#
This is by design for things like message order preservation and the serial nature of the global channel map. Currently only one message can process through a channel.