web stats
passing a variable between 2 channels - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 05-24-2019, 09:35 AM
vralii vralii is offline
What's HL7?
 
Join Date: Feb 2019
Posts: 1
vralii is on a distinguished road
Default passing a variable between 2 channels

I have a for loop in channel 1 calling channel 2 (http post/response) using router. routeMessageByChannelId for each record in the for loop. Each time it returns back to channel 1, I want a variable from channel 2 to be available to channel 1 but itís not.

Whatís the appropriate way to pass variable from channel 2 to channel 1? Is it this way:
1. In channel 2: globalChannelMap.put(<key>, <value>);
2. In channel 1: globalChannelMap.get(<key>);
NOTE: I also tried channelMap instead of globalChannelMap

I checked after running both channels and donít see the variable Iím hoping for in channel 1, but I see it in channel 2. I also donít see the variable in channel 1 during development.

Thanks for any help.
Ray
Reply With Quote
  #2  
Old 05-29-2019, 06:20 AM
obsessio obsessio is offline
OBX.3 Kenobi
 
Join Date: Mar 2015
Location: Turkey
Posts: 164
obsessio is on a distinguished road
Default

Channel Map is isolated to the current message as it procewsses through channel. If you store connector map variable in the source connector, you will gave access to that in all subsequent destinations.

Global channel map is isolated to a spesific channel, but accross multiple messages. You can store a value during a message processing lifecycle and it will be available during the lifecycle of the next message.

You should use Globa Map, this map will be accessible throughout the entire server, across all channels and all messages. That means you can store a value during message processing in opne channel and use that value from a different channel.
Reply With Quote
Reply

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 01:05 AM.


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