web stats
Use threads.sleep and handle multiple messages - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-11-2019, 05:26 AM
artturi artturi is offline
What's HL7?
 
Join Date: Dec 2018
Posts: 4
artturi is on a distinguished road
Default Use threads.sleep and handle multiple messages

Hi,

I have file reader channel with two destinations. First sends data to an API, the second also sends data to an API, but it must wait about 15 minutes after the first one is finished.

I am using "Wait for previous destination" and

Packages.java.lang.Thread.sleep(900000);

to achieve this. However, I cannot get the channel to read and handle multiple messages concurrently. I have set Max Processing Threads to 10 but it still reads only one file at a time.

My Source Queue is off and Process Batch is No.

Poll schedule is interval (20 seconds)

Can anyone help?

Thanks!
Artturi
Reply With Quote
  #2  
Old 06-11-2019, 12:57 PM
mcanalld mcanalld is offline
OBX.1 Kenobi
 
Join Date: May 2008
Posts: 26
mcanalld is an unknown quantity at this point
Default

Why not write the message to a folder on 1st dest success. Then have another channel reader that only reads messages from that folder when they are 15 minutes old.
Reply With Quote
  #3  
Old 06-11-2019, 10:20 PM
artturi artturi is offline
What's HL7?
 
Join Date: Dec 2018
Posts: 4
artturi is on a distinguished road
Default

Hi,

Well that would solve this problem.. However It still leaves the question open as to why Max Processing threads has no effect. Apparently using Thread.sleep prevents it?

Anyways, I'll do the solution you suggested. Thanks!
Reply With Quote
  #4  
Old 06-12-2019, 08:48 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 749
agermano is on a distinguished road
Default

I think a polling connector won't poll again until the previous poll is complete. I would expect if multiple files are present when the poll occurs it will process them concurrently up to your max processing threads.

However, if new files come in, I don't think it will poll again until the last file from the previous poll finishes (which is where your sleep comes in.)

Does this match the behavior you are seeing?
Reply With Quote
Reply

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 12:12 PM.


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