Using custom logic (for HCM as well)

As of version 1.1 for HL7 Comm and 0.3 for HCM, you have the ability to specify additional jars in the configuration file and use classes within those jars as clients, business logic or ACK/NACK logic for HL7 Comm and HCM. At the moment, there’s not support for adding the additional parameters to the configuration files through the GUI, but it’s simple to add by hand and make it work.

For example, here’s a configuration file that contains just an inbound and outbound client (no logging) and a BSH logic script loaded from the filesystem. This is easily configured through the HL7 Comm GUI today:


%HL7 Comm%
{Simple Controller}
logLevel=DEBUG
controllerName=Simple Trigger
[Logic|org.nule.integrateclient.samples.BshLogicAgentFromFile]
scriptFile=/Users/mike/simplescript.bsh
[In:0|org.nule.integrateclient.util.InboundTrigger]
sleep=60000
[Out:0|org.nule.integrateclient.net.Hl7Client]
sendHost=localhost
sendPort=12345
haltOnAr=false
haltOnAe=false

Now here we want to use an extended version of the InboundTrigger class that’s contained in a jar file on the filesystem. First we add a “jarUrls” parameter to the configuration file, then change the fully qualified path of the client we’re using:


%HL7 Comm%
{Simple Controller}
logLevel=DEBUG
controllerName=Simple Trigger
jarUrls=/Users/mike/Jars/ExtendIntegrateClientTest.jar
[Logic|org.nule.integrateclient.samples.BshLogicAgentFromFile]
scriptFile=/Users/mike/simplescript.bsh
[In:0|org.nule.testextend.client.ExtendInboundTrigger]
sleep=60000
[Out:0|org.nule.integrateclient.net.Hl7Client]
sendHost=localhost
sendPort=12345
haltOnAr=false
haltOnAe=false

Now, this configuration should be able to run on either HL7 Comm or HCM without any hacking of the classpath or messing about with jar files as long as they’re in the location specified in the configuration.

A quick word about the makeup of the configuration file. It’s a pretty simple delimited file with the following parts.

There’s what’s called a “management agent” header specified by the percent signs, in this case “%HL7 Comm%”. That’s not really used as any of the configs work with HL7 Comm and HCM, so leave this part be.

The controller agent is delimited with curly braces, in this case “{Simple Controller}”. Again, at the moment, no matter how you’re running these configs, they’re all compatible with this controller, so leave that be as well.

Immediately after the controller, are parameters that are associated with that controller, in this case “logLevel” and “controllerName”. Here, we add a third parameter “jarUrls” as shown in the example above (the name is a bit misleading, as only file paths can be used, not full URLs). You can also specify more than one jar by separating them with a comma. You must use a path that’s recognized by java as a valid file specification. An example might look like:


jarUrls=/path/to/MyJar1.jar,/path/to/MyJar2.jar

Now each of the controller agents (and there can be only one in a config file for current versions of the software) can have a number of clients associated with them. In the example above there were just an inbound, an outbound client and a logic client, but there could also be a log client and possibly multiple inbound and outbound clients. Essentially, though, if you’re just interested in changing the class used by a client, and potentially parameters you’ve coded the class to use, you can do that pretty easily and obviously, by editing that client’s section of the config.

The client section starts with a line delimited with square braces containing a client specifier followed by a class like so:


[In:0|some.package.MyClass]
myParam1=myValue
myParam2=someOtherValue

Here, the inbound client (the first one specified by a zero) is extended by the MyClass class of the “some.package” package. It was coded (presumably by you) two take two parameters, which are also contained within this section. Any parameter here will be read until another delimited section is found.

Hopefully this is enough information to help get you started with using your custom classes as clients in this software. As always leave a message on the support forum if you’re having problems.

Leave a Reply

You must be logged in to post a comment.