Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to maintain state between calls to the batch split javascript function #4139

Open
rbeckman-nextgen opened this issue May 11, 2020 · 1 comment

Comments

@rbeckman-nextgen
Copy link
Collaborator

@rbeckman-nextgen rbeckman-nextgen commented May 11, 2020

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

@rbeckman-nextgen
Copy link
Collaborator Author

@rbeckman-nextgen rbeckman-nextgen commented May 11, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.