web stats
Prioritize messages based on a field - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 08-19-2015, 02:49 AM
lionelroux lionelroux is offline
OBX.2 Kenobi
Join Date: Apr 2013
Posts: 82
lionelroux is on a distinguished road
Exclamation Prioritize messages based on a field


I've an ORU channel which is an outbound collector for several other source channels.
Each one computes data and sends an ORU message with a PDF attachment to the outbound channel whose role is to send one by one to an Alfrecso instance.
I can't clone the outbound channel because the Alfresco instance is very loaded and it can't handle more parrallel processing (we have 30+ secretary sending manually documents in addition to this channel).

I'm looking for a solution to prioritize message based on their types.
Emergency reports have to be sent quickly; on the other hand, visit reports are not urgent and could be send later.

Is there a way to prioritize messages ?
The queue thread mechanism does not seem to be a correct way to do this.

Thx in advance.
Reply With Quote
Old 08-19-2015, 08:37 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road

Multiple queue threads could actually help you here. In 3.2 we added the Thread Assignment Variable, which allows you to determine which messages are delegated to which threads. You could use 2 queue threads, then set your thread assignment variable to, for example, "edReports". Then in your transformer set that variable in your connector/channel map, with a value of true or false based on whether it's an ED report.

That way all ED reports are guaranteed to go to a specific queue thread. Now, since in the background a hash function is used to assign queue threads, it's possible that the ED report messages and the other messages could collide into the same queue thread. In that "worst" case it's basically the same as you have now, 1 queue thread. But if that happens you can just redeploy the channel. When the channel is deployed, the destination queue's hash function is initialized with a random seed.

Or, instead of using the same value for every non-ED report ("false"), you could use a value that's different every time (like a unique patient ID, or even a random UUID). That way the non-ED reports would be more or less evenly distributed among every queue thread. It would prevent everything from collapsing into one queue thread, but of course it also means that some of the non-ED report messages would go into the same queue thread as the ED reports. So this solution is better the more queue threads you have (like say 10 of them).
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.

- How do I foo?
- You just bar.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 02:51 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation