简体   繁体   中英

Mirth Channel Map Not Defined Error In Source Javascript Reader

I am using $c variables for db connectivity[i declared those variables in preprocessor script] in javascript reader as a source even I used channel map variables I am getting channel map not found error... Tried&Failed cases: 1.Added code template Lib[In Lib declared one function for db conn using those two channel map variables as parameters]. 2.used those $c variables and called function as one of step in transformer and returned the db conn variable name. 3.used $c variables and called function in deploy script as global map variables as well 4. declared like channelMap.put(dbconn,Dbconn); in source js reader Expected result: Source connector should connect to the db and read the data and return msg.

FYI: only for db connectivity I declared function and $c variables

The channelMap doesn't exist in a Javascript Reader because that is a message specific map, and in a JS Reader context, you are creating messages that don't yet exist.

A preferred solution would be to use a different Map. The configurationMap is designed for this. You edit it in the server settings, and it is read-only in your channel.

Another solution that is completely contained within the channel is to use the globalChannelMap. That will allow you to set the value once in the deploy script, and access as needed.

If you need to set the value using information that is only available in the JS Reader, you need to return your messages as RawMessages rather than strings, and you can place values into the sourceMap at the time you are creating the RawMessages.

See the official User Guide available on the mirth downloads page for more information about the different Maps and their intended purposes. Also for allowed return values from a Javascript Reader. See the User API javadoc for more information about creating RawMessages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM