Giter Site home page Giter Site logo

Comments (13)

narupley avatar narupley commented on May 19, 2024

That should be possible! The POST /server/resources/{resourceId}/_reload endpoint in the API can be used to programmatically reload a resource. The "default" resource created automatically with Connect points to the custom-lib folder and has an ID of Default Resource.

from connect.

redeemefy avatar redeemefy commented on May 19, 2024

That should be possible! The POST /server/resources/{resourceId}/_reload endpoint in the API can be used to programmatically reload a resource. The "default" resource created automatically with Connect points to the custom-lib folder and has an ID of Default Resource.

Questions about that approach:

  1. Do all channels are going to bounce when the resource reload happens?
  2. If so, Does Mirth will finish all channels that currently are processing msgs and once that is done then load the library.

I'm trying to avoid the loss of any msg in this process.

Thanks

from connect.

narupley avatar narupley commented on May 19, 2024

No channels will need to be redeployed and no messages will be interrupted. After the library resource is reloaded, on the next message your channel processes the new ClassLoader should be used, for example in a JavaScript script that uses your custom JAR.

from connect.

redeemefy avatar redeemefy commented on May 19, 2024

No channels will need to be redeployed and no messages will be interrupted. After the library resource is reloaded, on the next message your channel processes the new ClassLoader should be used, for example in a JavaScript script that uses your custom JAR.

This is awesome!
Thanks @narupley

from connect.

redeemefy avatar redeemefy commented on May 19, 2024

I want to followup in this question. I have a custom library that I wrote that I putted it in the custom_lib folder. After that I clicked the reload button. I'm getting the error that the function is not found. I'm afraid that clicking the reload button is not refreshing/reloading/clearing some sort of heap/ram/database.

My idea of utilizing a library in jar was to avoid to bounce Mirth.

Does anyone can bring some light to this issue?

from connect.

narupley avatar narupley commented on May 19, 2024

Does the JAR file should show up in the list of files in the Resource settings? You also need to make sure that the channel you're using includes that resource in the proper context (Summary tab, Set Dependencies, Library Resources). If you're using a custom library in the global scripts not tied to any channel, there is an option for that on the Directory Resource settings page.

from connect.

redeemefy avatar redeemefy commented on May 19, 2024

Does the JAR file should show up in the list of files in the Resource settings?

It does.

You also need to make sure that the channel you're using includes that resource in the proper context (Summary tab, Set Dependencies, Library Resources). If you're using a custom library in the global scripts not tied to any channel, there is an option for that on the Directory Resource settings page.

All those settings are set as expected. This is not the only library we are using and is not the only function from the library. This library is a class that has around 5 functions. So far we are using just one function. Now I want to use another function from the same jar/class. That function was added today and I just replaced the jar and clicked the reload. I have done that several times now and still can't see the new function.l

from connect.

narupley avatar narupley commented on May 19, 2024

Hmm I just tested it out and it appears to work fine for me. I tested using a custom JAR and a channel invoking it in a script, and then dropped a new version of the JAR into the directory. After reloading the resource the next message that flowed through the channel automatically used the new version of the JAR without needing to do anything else (no restarting or redeploying).

from connect.

redeemefy avatar redeemefy commented on May 19, 2024

Hmm I just tested it out and it appears to work fine for me. I tested using a custom JAR and a channel invoking it in a script, and then dropped a new version of the JAR into the directory. After reloading the resource the next message that flowed through the channel automatically used the new version of the JAR without needing to do anything else (no restarting or redeploying).

What version of Mirth are you using for the test?

Also, I deleted the jar from custom_lib, reload the resources, and saw that the jar is no longer there, redeployed the channel, and the functions in the channel still load from the jar that no longer exists. Witchcraft stuff man.

I'm wondering if there is a setting in Mirth that keeps custom_lib/ in memory until restarting Mirth?

from connect.

tonygermano avatar tonygermano commented on May 19, 2024

@diazgilberto This could happen if you have in your mirth.properties file the setting server.includecustomlib set to true. The description in the user guide says:

Determines whether libraries in the custom-lib directory will be included on the server classpath.
To reduce potential classpath conflicts you should create Resources and use them on specific channels/connectors instead, and then set this value to false

from connect.

redeemefy avatar redeemefy commented on May 19, 2024

@diazgilberto This could happen if you have in your mirth.properties file the setting server.includecustomlib set to true. The description in the user guide says:

Determines whether libraries in the custom-lib directory will be included on the server classpath.
To reduce potential classpath conflicts you should create Resources and use them on specific channels/connectors instead, and then set this value to false

I will check and let you know.

from connect.

redeemefy avatar redeemefy commented on May 19, 2024

@tonygermano that did the trick. Thanks so much. One last question. In the resources UI I can't find the resource ID of my .jar. I need that to POST /server/resources/{resourceId}/_reload.

Whare I can get that ID for remote reload my resources.

from connect.

redeemefy avatar redeemefy commented on May 19, 2024

{resourceId}

The {resourceId} is the name of the library

from connect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.