Open rbeckman-nextgen opened 4 years ago
It is possible to maintain state using the globalChannelMap but because that map is global to the channel I think you can run into concurrency issues in some cases. The proposed solution limits the scope of the state object to the batch spliiter for that batch message, which mitigates any currency issues that could happen across messages on the channel.
Imported Comment. Original Details: Author: jerchap Created: 2018-04-30T11:01:03.000-0700
When using the Batch Split functionality with the Split Batch By set Javascript I'd like the ability to maintain some state across each call to the javascript function.
This could be achieved by passing some state object (a map) to the function, which could be managed within the function. The state object could be created by Mirth before the first call, and destroyed by Mirth after the last call to the function. The object would only need to be maintained in memory for the duration of the batch splitting operation.
I have found a need for this, because when splitting, I need each output message to contain some of the same information from the inbound message. In these instances using router.RouteMessage from a filter or transform is undesirable.
Imported Issue. Original Details: Jira Issue Key: MIRTH-4263 Reporter: jerchap Created: 2018-04-25T14:17:40.000-0700