web stats
Potential to lose message when stopping a channel - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-21-2014, 05:52 AM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default Potential to lose message when stopping a channel

I have built a polling javascript reader channel which reads approx. 15000 messages into a java.util.ArrayList(). I have noticed that I am able to stop the channel before it has finished processing the content of the ArrayList and adding these messages to the queue effectively losing the messages.

I have tried with and without a source connector queue and it does not appear to make any difference. I can stop the channel dead after I know that I have added the last message to the ArrayList, but before they have all processed in through the source.

Has anyone any advice they can give me? I wouldn't have expected the channel to stop while it was still reading in messages from the ArrayList.

I am using Mirth Connect 3.0.3.

Simon
Reply With Quote
  #2  
Old 07-21-2014, 05:58 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,298
cory_cole is on a distinguished road
Default

You can save the array to the globalMap and keep track of the index.
Reply With Quote
  #3  
Old 07-21-2014, 06:11 AM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default

That is a good suggestion, but the behaviour does seem inconsistent with other types of channel where you see a 'Stopping' status while it finished message processing. I wonder if any of the development team would like to comment?
Reply With Quote
  #4  
Old 07-21-2014, 08:05 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,298
cory_cole is on a distinguished road
Default

This reason is that you are using an array. It will finish the processing of the message that it is on.
Reply With Quote
  #5  
Old 07-21-2014, 08:32 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

That is expected. Stopping a channel will allow a currently processing message to finish. So if you're in the middle of processing message 5000 of 15000 from your ArrayList then stopping the channel will still allow that message to finish. At that point the channel is fully stopped and any subsequent dispatches will be rejected.
__________________
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
  #6  
Old 07-21-2014, 08:41 AM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default

Thank you both for your responses,
Simon
Reply With Quote
  #7  
Old 07-31-2014, 12:15 PM
RJKHL7 RJKHL7 is offline
Mirth Newb
 
Join Date: Jun 2014
Posts: 16
RJKHL7 is on a distinguished road
Default Gotchas of Arraylist...

So with that in mind,(keeping track of the ArrayList and its index in the gc map area):

Where would the preferred place be in the channel itself to code for the "resume" on the process. PreProcess, or Source Transformer? Not exactly sure where it would go? Say for instance In the channel:
-I copy the ArrayList to gc map
-As each iteration of the ArrayList completes I update the gc map Index var
-Once process completes empty the cachced copy in gc map

I would think in this scenario, I would want to place the code in Preprocessor to repopulate the arraylist thats being resumed. Would also need specific logic in src xformer to handle the "resume" rather than starting at the top and over-riding the historic data.

Is that a correct assumption?
__________________
Engine: Mirth 2.2.2.6388
JRE:1.7.0
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 01:11 PM.


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