web stats
channlId in deploy script - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-02-2014, 12:19 PM
Anirudh Anirudh is offline
OBX.3 Kenobi
 
Join Date: Sep 2012
Posts: 135
Anirudh is on a distinguished road
Default channlId in deploy script

channelId doesn't seem to be working in deploy script when I am trying to put it in a globalMap. Sorry to add this is in mirth 3.0 version.
I see the following error on the dashboard while deploying the channel

[2014-06-02 20:17:31,951] ERROR (com.mirth.connect.server.controllers.DonkeyEngine Controller:174): Error executing global deploy script.
com.mirth.connect.server.util.javascript.JavaScrip tExecutorException: com.mirth.connect.server.MirthJavascriptTransforme rException: SOURCE CODE:
LINE NUMBER:
6549DETAILS:
ReferenceError: "channelId" is not defined.
at Deploy:6549 (doScript)
at Deploy:6555
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.execute(JavaScriptUtil.java:62)
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeGlobalDeployScript(JavaScriptUtil.jav a:395)
at com.mirth.connect.server.controllers.DefaultScript Controller.executeGlobalDeployScript(DefaultScript Controller.java:137)
at com.mirth.connect.server.controllers.DonkeyEngineC ontroller.deployChannels(DonkeyEngineController.ja va:172)
at com.mirth.connect.server.servlets.EngineServlet.do Post(EngineServlet.java:64)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(Ser vletHolder.java:652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle( ServletHandler.java:447)
at org.eclipse.jetty.server.session.SessionHandler.do Handle(SessionHandler.java:225)
at org.eclipse.jetty.server.handler.ContextHandler.do Handle(ContextHandler.java:1038)
at org.eclipse.jetty.servlet.ServletHandler.doScope(S ervletHandler.java:374)
at org.eclipse.jetty.server.session.SessionHandler.do Scope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ContextHandler.do Scope(ContextHandler.java:972)
at org.eclipse.jetty.server.handler.ScopedHandler.han dle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerList.handl e(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.ha ndle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java :363)
at org.eclipse.jetty.server.AbstractHttpConnection.ha ndleRequest(AbstractHttpConnection.java:483)
at org.eclipse.jetty.server.AbstractHttpConnection.co ntent(AbstractHttpConnection.java:931)
at org.eclipse.jetty.server.AbstractHttpConnection$Re questHandler.content(AbstractHttpConnection.java:9 92)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpPa rser.java:856)
at org.eclipse.jetty.http.HttpParser.parseAvailable(H ttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handl e(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SslConnection.handle(SslC onnection.java:196)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.han dle(SelectChannelEndPoint.java:627)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.r un(SelectChannelEndPoint.java:51)
at org.eclipse.jetty.util.thread.QueuedThreadPool.run Job(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.r un(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:662)Caused by: com.mirth.connect.server.MirthJavascriptTransforme rException: SOURCE CODE:
LINE NUMBER:
6549DETAILS:
ReferenceError: "channelId" is not defined.
at Deploy:6549 (doScript)
at Deploy:6555
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(JavaScriptUtil.java:490)
at com.mirth.connect.server.util.javascript.JavaScrip tUtil$4.call(JavaScriptUtil.java:401)
at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.jav a:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
... 1 more

Last edited by Anirudh; 06-02-2014 at 12:23 PM.
Reply With Quote
  #2  
Old 06-02-2014, 12:26 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

That is expected. The global deploy script is channel-agnostic; it runs once whenever you deploy one or more channels. Therefore, you don't have access to the "channelId" variable in there.
__________________
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 06-02-2014, 12:28 PM
Anirudh Anirudh is offline
OBX.3 Kenobi
 
Join Date: Sep 2012
Posts: 135
Anirudh is on a distinguished road
Default

Thanks for the reply. Is there any other way that I can put channelId in a global Map
Reply With Quote
  #4  
Old 06-02-2014, 12:29 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

Quote:
Originally Posted by Anirudh View Post
Thanks for the reply. Is there any other way that I can put channelId in a global Map
A channel's deploy script has access to the channel ID, so you can do whatever you need there. If you're going to be reusing the same code in multiple channels, it'd probably make sense to use a code template.
__________________
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
  #5  
Old 06-02-2014, 12:33 PM
Anirudh Anirudh is offline
OBX.3 Kenobi
 
Join Date: Sep 2012
Posts: 135
Anirudh is on a distinguished road
Default

Quote:
Originally Posted by narupley View Post
A channel's deploy script has access to the channel ID, so you can do whatever you need there. If you're going to be reusing the same code in multiple channels, it'd probably make sense to use a code template.
I did see the channelId variable is accessible through deploy script when I place it in a global map

globalMap.put('ADT-CHANNELID',channelId);

I am trying to use the channelId in one of the other channels. The only way I can use the channelId is getting the value from globalMap. Any other suggestions are welcome.
Reply With Quote
  #6  
Old 06-02-2014, 12:35 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

I don't quite understand what you're trying to do. Maybe try rephrasing your question, with more clear examples?
__________________
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
  #7  
Old 06-02-2014, 03:02 PM
Anirudh Anirudh is offline
OBX.3 Kenobi
 
Join Date: Sep 2012
Posts: 135
Anirudh is on a distinguished road
Default

Quote:
Originally Posted by narupley View Post
I don't quite understand what you're trying to do. Maybe try rephrasing your question, with more clear examples?
Sorry for the late response. Below is what I am trying to do:

1. Reading channel id's and channel name's from database.
2. Once I have the channel Id's from the database I am planning to compare the with the channelId's of the channels which are deployed.
3. Each channel has a set of global maps which I will be using as a part of monitoring channel.
4. If the channelId matches use the global maps of the channel this is where I require globalMap of channel id's of the channel.

If there is any other way that I can get channelId's in a global map that can be used by a channel that would be great.
Reply With Quote
  #8  
Old 06-03-2014, 05:32 AM
Anirudh Anirudh is offline
OBX.3 Kenobi
 
Join Date: Sep 2012
Posts: 135
Anirudh is on a distinguished road
Default

Nick, How can I get the globalMaps from a channel based on ChannelID. Any inputs please.
Reply With Quote
  #9  
Old 06-03-2014, 12:03 PM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default

You mean the globalChannelMaps from another channel? e.g.

Code:
var myChannelId = "15aad193-8205-476b-8d05-4db4c0532c77";
var otherChannelglobalChannelMap = com.mirth.connect.server.util.GlobalChannelVariableStoreFactory.getInstance().get(myChannelId).getVariables();

logger.info(otherChannelglobalChannelMap.get("test"));
Reply With Quote
  #10  
Old 06-03-2014, 12:06 PM
Anirudh Anirudh is offline
OBX.3 Kenobi
 
Join Date: Sep 2012
Posts: 135
Anirudh is on a distinguished road
Default

Thanks Seaston I will try this one out .I am trying to get GlobalMaps from all the channels and if there is a variable defined in global map I will use it otherwise I will use default value. Will give this a try.
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 02:37 PM.


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