|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Get the Server Name in Flow |
« View previous topic :: View next topic » |
Author |
Message
|
lancelotlinc |
Posted: Wed Feb 01, 2012 10:36 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
kash3338 wrote: |
Again, this discussion has gone a long way about the real need of HostName which my ESQL is not able to fetch for me and there are so many supporters for the features offered by ESQL and argue that HostName is of no use and hence it does not come as part of Broker Properties
Agreed it does not make much sense, but the XML that we generate is generic to some many other applications as well and there is a field called Host name in it, which we have to populate from our flow. Thats the only reason and we can remove it if we have to invoke a Java app just to get this info.
I was curious to know if there is way out of Java to achieve this. |
Yes, ESQL is able to fetch hostname.
Code: |
ESQL:
CREATE PROCEDURE getHostName( )
RETURNS CHARACTER
LANGUAGE JAVA
EXTERNAL NAME "com.<yourcompanyname>.middleware.common.util.WmbUtils.getHostName";
SET hostname = getHostName();
...
Java:
public static String getHostName()
try
{
java.net.InetAddress localMachine =
java.net.InetAddress.getLocalHost();
return localMachine.getHostName();
}
catch(catch(java.net.UnknownHostException uhe)
{
//handle exception
}
|
Why are you so stubborn about Java ? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
kamy |
Posted: Wed Feb 01, 2012 12:37 pm Post subject: |
|
|
Novice
Joined: 26 Oct 2001 Posts: 21
|
We had a similar requirement to populate the hostname in order to interface with HP open-view for error handling and problem management. |
|
Back to top |
|
 |
kash3338 |
Posted: Thu Feb 02, 2012 7:14 am Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
lancelotlinc wrote: |
Why are you so stubborn about Java ? |
I am not stubborn on using Java, infact my current solution is the same as you have posted
Just wanted to know if there is a direct function like Broker Properties from ESQL. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Feb 03, 2012 7:35 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I don't understand what the hangup on the hostname is.
Just like mqjeff specified I would have thought that the broker's name or the broker's qmgr name would be the more important information.
Just because the environment the requester comes from asks for a hostname does not mean that it will be the most important information germane to the request processing and troubleshooting.
Imagine using 50 J2EE server instances on 3 boxes. What do you believe will be more important as information: the name of the server instance or the name of the host it resides on?
The same way, the most important information for the flow would be the broker it runs on, the execution group it runs in, the flow name being run...
All this is available at runtime.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqsiuser |
Posted: Sat Feb 04, 2012 3:07 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
I guess the development of ESQL was demand driven (and not like "we put in this hip-language here and this hip-W3C-standard there"). No need for anyone to request the hostname in the early days (or even/probably? good reasons to reject such requests?!).
Use Java. If you have issues open a PMR (as always, just to say "use Java, it is supported!").
Into the field hostname put in the name of where your code is hosted:
Code: |
SET hostname = BrokerName + '.' + ExecutionGroupLabel + '.' + MessageFlowLabel; |
Then one day operations will come to you and say 'wow this information is so much better than the machine's name!' _________________ Just use REFERENCEs |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|