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 the ability to configure shared resources that can be used by channels / connectors #3450

Closed
rbeckman-nextgen opened this issue May 11, 2020 · 15 comments
Milestone

Comments

@rbeckman-nextgen
Copy link
Collaborator

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

There are many possible applications for this. The most pressing one is a way to define custom library resources that can be used on a case-by-case basis with certain JavaScript contexts (overlaps with MIRTH-3553). However, another big one is shared database connection pools.

There are a couple parts to this. First, there should be a general settings panel to configure the resources, isolated from the channel settings. Then on the channel itself, there needs to be a way to "apply" those resources.

For now we'll concentrate on the JavaScript library resource part, but this will also pave the way for database connection pooling (MIRTH-2228).

Imported Issue. Original Details:
Jira Issue Key: MIRTH-3554
Reporter: narupley
Created: 2014-12-15T14:52:18.000-0800

@rbeckman-nextgen rbeckman-nextgen added this to the 3.2.0 milestone May 11, 2020
@rbeckman-nextgen
Copy link
Collaborator Author

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

Revision 7494: A new set of plugin points have been added to allow shared resources for channels/connectors to be configured. There is a new "Resources" tab in the Settings view where resources can be added/modified. Each resource has a type, for example "Library", "Mirth Results", or "Database". The first resource cannot be removed, and by default it uses the Library type, and points to the custom-lib directory. Any new channel/connector created (as well as migrated channels/connectors) will use the custom-lib resource by default.

Imported Comment. Original Details:
Author: narupley
Created: 2014-12-15T15:12:04.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

Appears to be a bug when creating a channel with multiple destinations. Steps to reproduce

  1. Create a channel
  2. Create 3 or more destinations
  3. Check the resource settings. All destinations except the first and last are not using the default resource.
  4. This appears to ultimately cause the following exception when the message is processed through the second destination

ERROR 2014-12-22 17:49:52,346 [Thread-20] com.mirth.connect.donkey.server.channel.DestinationChain: Error processing destination Destination 2 for channel 9dcbaf93-74b4-4ba1-a063-1f9814cf383a. java.lang.NullPointerException at java.util.LinkedHashSet.<init>(LinkedHashSet.java:168) at com.mirth.connect.donkey.model.channel.DestinationConnectorProperties.<init>(DestinationConnectorProperties.java:67) at com.mirth.connect.connectors.vm.VmDispatcherProperties.<init>(VmDispatcherProperties.java:41) at com.mirth.connect.connectors.vm.VmDispatcherProperties.clone(VmDispatcherProperties.java:114) at com.mirth.connect.donkey.server.channel.DestinationConnector.process(DestinationConnector.java:411) at com.mirth.connect.donkey.server.channel.DestinationChain.call(DestinationChain.java:155) at com.mirth.connect.donkey.server.channel.Channel.process(Channel.java:1656) at com.mirth.connect.donkey.server.channel.Channel.dispatchRawMessage(Channel.java:1155) at com.mirth.connect.donkey.server.channel.SourceConnector.dispatchRawMessage(SourceConnector.java:191) at com.mirth.connect.server.controllers.DonkeyEngineController.dispatchRawMessage(DonkeyEngineController.java:514) at com.mirth.connect.server.servlets.MessageObjectServlet$2.run(MessageObjectServlet.java:190) at java.lang.Thread.run(Thread.java:745)

Imported Comment. Original Details:
Author: wayneh
Created: 2014-12-22T17:51:10.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

Fixed the above in r7516.

Imported Comment. Original Details:
Author: narupley
Created: 2015-01-06T11:16:02.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

Created and loaded my own custom classes into some test channels. Each of these channels were configured to work with their own custom resources. I also verified that the issue Wayne experienced no longer occurs.

Imported Comment. Original Details:
Author: jaysenp
Created: 2015-01-19T17:57:44.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

We will want to put some sort of cap in place so that users don't accidentally load in their entire filesystem.

Imported Comment. Original Details:
Author: narupley
Created: 2015-02-05T15:11:12.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

Revision 7586: The maximum number of files allowed to be loaded by directory resources is now 1000. On the server side, it will attempt to load the first 1000 URIs, subsequent ones will be skipped, and an error will be sent to the server log. On the client side, when saving or reloading resources it will first prompt the user, warning them of the cap.

Imported Comment. Original Details:
Author: narupley
Created: 2015-02-05T15:13:34.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

Would it make sense to add a checkbox next to the path textfield to "Include sub-directories"?

This is probably a common question a user would have when typing in the folder. The tooltip could tell them, but a checkbox right there is more obvious and gives them control over it as well.

Imported Comment. Original Details:
Author: brentm
Created: 2015-02-05T15:21:16.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

Agreed, it couldn't hurt to add the option.

Imported Comment. Original Details:
Author: narupley
Created: 2015-02-05T15:27:13.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

A new property has been added to the directory resource properties to determine whether or not to recursively scan subdirectories when loading files. By default this is enabled to keep the same behavior as pre-3.2 with the custom-lib folder.

Imported Comment. Original Details:
Author: narupley
Created: 2015-02-05T15:51:17.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

Verified the inclusion/exclusion of resources when using sub directories. Ensured that resources were not loaded and used when the appropriate settings were configured.

Imported Comment. Original Details:
Author: jaysenp
Created: 2015-02-12T15:15:13.000-0800

@rbeckman-nextgen
Copy link
Collaborator Author

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

can you explain more how to use javascript as resource files? We are using heavy javascript and have a TON of code templates which are difficult to keep versioned and maintained within the Mirth UI. I'd rather version them in source control and deploy the javascript files via javascript resource library.

Thanks!

Imported Comment. Original Details:
Author: sessionsr
Created: 2015-03-10T21:37:29.000-0700

@rbeckman-nextgen
Copy link
Collaborator Author

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

also, if there's any way to put intellisense tags into our javascript files to hook into the auto-complete.......assuming we get the javascript resource library working, this would be phenominal!

Imported Comment. Original Details:
Author: sessionsr
Created: 2015-03-10T21:38:15.000-0700

@rbeckman-nextgen
Copy link
Collaborator Author

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

Both of the things you're talking about don't really have anything to do with this issue.

The first deals with code templates, and will be addressed with MIRTH-1892 and its subtasks. The second deals with the auto-completion changes made for MIRTH-3586. With MIRTH-3616 it's technically possible, you just have to put your sources JAR (filled with .java files) into client-lib, and then when you download the client via webstart those JARs will be included. We'll probably change that to use more standard method of inclusion though. You're talking about JavaScript, not Java, but custom code templates already do show up in the auto-completion list.

Imported Comment. Original Details:
Author: narupley
Created: 2015-03-10T23:14:02.000-0700

@rbeckman-nextgen
Copy link
Collaborator Author

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

Maybe I jumped the gun and got too excited when I read "For now we'll concentrate on the JavaScript library resource part". This led me to believe I could bring my code templates OUT of Mirth into the file system where they are more manageable and then have mirth bring them in at runtime via JavaScript Library Resource.

We are doing heavy javascript to map the XML into JSON and process messages into a pooled database connection. This is allowing us to focus on coding in one area (we are developers) rather than jumping through all of these tabs and UI screens to click and drag things around or copy and paste through channels. The only piece we are missing is an ability to deploy our javascript from the file system.

If there is a way to do this with RequireJS or CommonJS, please point us in the right direction as those 2 framework are hard to incorporate into a non-HTML DOM scenario.

Imported Comment. Original Details:
Author: sessionsr
Created: 2015-03-11T07:00:19.000-0700

@rbeckman-nextgen
Copy link
Collaborator Author

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

Sorry, I should have specified in the original description. What was being referred to at the time was groups of Java libraries (JARs) that can be included in JavaScript contexts. Similar to how you can reference Apache Commons FileUtils or other Java classes/methods within JavaScript.

General improvements to code templates are definitely planned though, with MIRTH-1892.

Imported Comment. Original Details:
Author: narupley
Created: 2015-03-11T07:19:23.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.