ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Config File Values

Post new topic  Reply to topic
 Config File Values « View previous topic :: View next topic » 
Author Message
bjr149
PostPosted: Wed Mar 10, 2010 12:40 pm    Post subject: Config File Values Reply with quote

Novice

Joined: 03 Mar 2010
Posts: 22

I can't find a good way to store configuration properties for the message flows. I don't want to hard code them in the JavaCompute node, I don't want to hardcode a path to the log4j.properties file and the UDP is not working for me either. For the UDP I got them to work but unless there is another way to get the data out it defeats the purposed because you need to input the broker name, service name, etc... meaning if you ever move it you will have to touch the code. Here is the code I am using for the UDP. Is there another way? If not I don't see why these are really dynamic. If you pickup and move to a broker with another name or use the JavaCompute node code in multiple flows it wouldn't work.. Correct?


Code:

   public void onInitialize() throws MbException
   {
      
      String brokerName = getBroker().getName();
      
      try
      {
         ConfigManagerConnectionParameters cmcp = new MQConfigManagerConnectionParameters("localhost", 1414, "STUDENT01");
         ConfigManagerProxy cmp = ConfigManagerProxy.getInstance(cmcp);
         TopologyProxy t = cmp.getTopology();
         BrokerProxy b = t.getBrokerByName("STUDENT01");
         ExecutionGroupProxy e = b.getExecutionGroupByName("STUDENT01");
         MessageFlowProxy m = e.getMessageFlowByName("JavaNodeTestRouteToLabel");
         String x = (String)m.getUserDefinedProperty("dirOfConfigFile");
         log.info("dirOfConfigFile = " + x);
      }
      catch(Exception e)
      {
         log.error(e.toString());
      }
      
   }
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Mar 10, 2010 1:24 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Ok, I don't know Java from anything, but it seems to me odd that you're using a UDP (which can store a property) to hold the directory of a file that holds properties....

It's certainly not true that you have to touch the code to change a UDP. It's also likely that if you run the node in various flows and locations you'd want to change the values.

The best I can offer is to use the search faciltity. There have been a number of discussions recently on the value of using properties files inside WMB like it's actually WAS running an MDB, and options open to you, as well as the use of log4j within WMB. My Java is insufficient to really comment on your code.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Mar 11, 2010 3:09 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If you are running inside a message flow, you DO NOT NEED TO USE THE CMP to get at a UPD.

Look at the MB Java API again. I've not double-checked, but I'm pretty sure that the MbMessage class has something straight forward like "getUserDefiendProperty()".

If you wish to *change* a UDP without REDEPLOYING, then you need to use the CMP to talk to the broker. But you should never need to use this code inside your message flow.
Back to top
View user's profile Send private message
bjr149
PostPosted: Thu Mar 11, 2010 5:41 am    Post subject: Reply with quote

Novice

Joined: 03 Mar 2010
Posts: 22

Vitor - The UDP will store the location of the log4j properties file..



The getUserDefinedProperty() function is under the MessageFlowProxy class. But according to the API the only way to get it is the following (Directly from the API)

Code:

Represents a message flow that has been deployed to an execution group. In order to use MessageFlowProxy objects, applications must first obtain handles to them. Here is an example of how to do this:

     ConfigManagerConnectionParameters cmcp =
         new MQConfigManagerConnectionParameters("localhost", 1414, "QMGR");
     ConfigManagerProxy cmp = ConfigManagerProxy.getInstance(cmcp);
     TopologyProxy t = cmp.getTopology();
     BrokerProxy b = t.getBrokerByName("BROKER1");
     ExecutionGroupProxy e = b.getExecutionGroupByName("default");
     MessageFlowProxy m = e.getMessageFlowByName("mf1");
 


According to this API the UDP's are kind of useless if you ever want to have multiple brokers? This is why I am so confused. I can't believe that there isn't a simple function to just get the values of the UDP?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Mar 11, 2010 7:13 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I still don't believe you have to use the CMP to get at these. I could be wrong on that point. Regardless you should still be able to use the getBroker(), getExecutionGroup() and getMessageFlow() methods of the MbNode interface to avoid "hardcoding" these values.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Mar 11, 2010 7:31 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

bjr149 wrote:
According to this API the UDP's are kind of useless if you ever want to have multiple brokers? This is why I am so confused. I can't believe that there isn't a simple function to just get the values of the UDP?


Like I said, I don't know Java from a hole in the ground so I can only defer to my associate.

But this works great in ESQL.....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Thu Mar 11, 2010 11:41 am    Post subject: Re: Config File Values Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

mqjeff wrote:
I still don't believe you have to use the CMP to get at these.

That is correct. The Java user-defined node API provides the com.ibm.broker.plugin.MbNode.getUserDefinedAttribute() method.

It's documented, among other places, here, here, and here.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Mar 11, 2010 11:44 am    Post subject: Re: Config File Values Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

rekarm01 wrote:
mqjeff wrote:
I still don't believe you have to use the CMP to get at these.

That is correct. The Java user-defined node API provides the com.ibm.broker.plugin.MbNode.getUserDefinedAttribute() method.

It's documented, among other places, here, here, and here.


I was reasonably sure this was the right thing to use, but didn't recall for sure off the top of my head, and didn't want to bother to test.
Back to top
View user's profile Send private message
bjr149
PostPosted: Thu Mar 11, 2010 12:35 pm    Post subject: Reply with quote

Novice

Joined: 03 Mar 2010
Posts: 22

I wasn't even paying attention to the extended class. I kept trying to get the MessageFlowProxy. This method works. Here is the syntax. Im sure others have asked the same question.


Code:

   public void onInitialize() throws MbException
   {
      logFileConfig = (String)getUserDefinedAttribute("dirOfLogConfig");
      
      try
      {
         log.debug("logFileConfig = " + logFileConfig);         
      }
      catch(Exception e)
      {
         log.error(e.toString());
      }
   }
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Config File Values
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.