web stats
RouteMessage using channel tags [3.0] - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2014, 05:44 PM
nkilzer nkilzer is offline
What's HL7?
 
Join Date: Jun 2014
Posts: 3
nkilzer is on a distinguished road
Default RouteMessage using channel tags [3.0]

HI,

We're currently using Mirth Connect 3.0 to implement a network between several Mirth Servers (sort of a mini-HIE, but including application-specific messaging as well). The design of the network calls for several "classes" of channel - with each class [Inbound, Outbound, Processing] having several cloned instances, each with minor tweaks for each node connected in the network - and I was trying to work out the best way to enable maximum reuse of the channel definitions between the various network nodes to ease our maintenance burden.

This network system (especially the central server in the hub-and-spoke configuration) would really benefit from being able to route messages dynamically between remote endpoint nodes and processing channels based on an internal node ID (which would represent one instance of a set of channel classes) and a message type. In order to enable easy deployment, though, I would prefer very much to not have to maintain a list of channel IDs or names anywhere, since in a disaster recovery scenario, we might not end up with the same channel IDs, and structured channel names are difficult to enforce, especially since we may end up needing to be able to match against multiple subsets of tags (wouldn't want a name like "[Inbound] [NodeID] [SubGroupMember] [SubGroup2Member] Message Receive Channel").

What I was thinking would work would be if we could retrieve the channel ID for a channel using a list of tags (the same tags that are used for the channel list in the Mirth Administrator) by getting all channels (either ID or some kind of object) that matched the tags - and then using that as a source for the ID for router.routeMessage(). This would allow us to keep a channel's codebase free of node identifiers (the endpoint addresses would be contained in the messages, and would be one of the tags), which would in turn mean we could just clone the channels and adjust the tags (and this can be tasked to a deployment manager, since we wouldn't have to redo the code-review for the channel when it gets cloned out to establish a new node).

However, after doing some digging, I wasn't able to find any functions exposed to the javascript side that would enable us to do get access to the tag collection. I was able to write a function to retrieve a Channel object from the Java side and then use that to match against the channel's tag collection (via com.mirth.connect.server.controllers.DefaultChanne lController), but I would prefer not to have production code depending on an internal function that could change at any time.

Have I overlooked an exposed utility class somewhere that allows for getting a channel ID given a set of channel tags? Is there behavior in the router that I overlooked that can do this? At a minimum, I'd need to be able to get a complete list of channel IDs, and then be able to pull their tag sets to write the functionality I'd like to see.

Also, is there a limit to the number of tags that can be added to an individual channel, and the distinct set of tags available in the server as a whole?

Thanks,
-- Nate

[Apologies for the length of the post - I wanted to give some background on what we're trying to accomplish, and my fear about the long-term maintainability of the ID/Name solution.]
Reply With Quote
  #2  
Old 06-06-2014, 05:56 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,117
narupley is on a distinguished road
Default

The ability to get channel IDs by tag is a good suggestion; I've added it as a comment to this issue: MIRTH-3292. Unfortunately right now there's nothing we explicitly expose JavaScript-wise to do that, so you would have to use internal controllers (and it looks like you're already aware of the implications of that).

Another thing you may be interested in is an upcoming feature in 3.1. Each server will have the ability to define its own "configuration map", which will be viewable and editable in the Administrator, able to be exported/imported/etc. So for example, you could have two instances with the exact same channels, except that certain IPs/ports are different. So instead of updating the channels themselves, you can use Velocity variables in those fields (like "${clientNameADTFeedIP}"), and define the variables in the configuration map. That way the actual channels can be literally identical.

If you have multiple feeds on different instances (like Prod, Dev, Staging), a common pattern is to have each channel send to the same last three port digits. Like you could say Prod is the 10k range, Dev is 11k, and Staging is 12k. When setting up a new client interface, you assign a port in all three ranges, like 10123, 11123, 12123. Then in the channel settings you would just have "${portPrefix}123", and set the portPrefix variable in the configuration map.

You can technically do all of that currently, using the global map and a global deploy script. But we hope to make that much, much easier with the configuration map. If you're a support customer, stay tuned to a future Developer Q&A webinar where we'll be demoing it.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 04-20-2017, 04:24 AM
prem prem is offline
What's HL7?
 
Join Date: Feb 2013
Posts: 1
prem is on a distinguished road
Default get channel statistics by filtering channels using Tags

Hi,

One of our requirements is to allow our client to view the status of the interface in a way they do not have to login to mirth. And to helps them monitor the relevant channels we intend to filter the list of Channels using the Channel tags but couldn't locate any Rest call https://xxx.xxx.xx.xx:8443/api/#/ that could bring the list of channels or Channel statuses by passing the tags.

I know this can be done in Administrator but is there a Rest Equivalent for this directly? The closest I could find was to get the list of all Channels using the GET /channels/statuses Rest call & then loop through each Channel to find the <tags></tags> section and then loop through the list of tags to find the correct one.

Regards
Prem

MC version : 3.4.2
Reply With Quote
Reply

Tags
mirth3.0, route, routemessage

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 11:54 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation