Author |
Message
|
titus |
Posted: Fri Apr 04, 2003 2:38 pm Post subject: Getting Brokername and Execution name inside a message flow |
|
|
Novice
Joined: 14 Oct 2002 Posts: 23
|
Could anybody please tell me how to get Broker name and execution group name inside a message flow. This information is for error handling purpose |
|
Back to top |
|
 |
kirani |
Posted: Fri Apr 04, 2003 10:38 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I wrote a plug-in node to do this. There are few methods, which will return you this information. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
titus |
Posted: Mon Apr 07, 2003 6:03 am Post subject: |
|
|
Novice
Joined: 14 Oct 2002 Posts: 23
|
Could you please tell me which methods i need to focus on for pluggin node option.
More over i am thinking of any other solution other than pluggin node. |
|
Back to top |
|
 |
kirani |
Posted: Mon Apr 07, 2003 7:25 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
the methods are...
Code: |
getMessageFlow().getName();
getBroker().getName();
|
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Maximreality |
Posted: Fri Nov 12, 2004 12:42 am Post subject: Re: Getting Brokername and Execution name inside a message f |
|
|
 Acolyte
Joined: 04 Jun 2004 Posts: 65 Location: Copenhagen
|
Instead of using plugin nodes you can call a java methid directly from your ESQL, but only if you are running CSD04
In ESQL create a procedure like this:
Code: |
CREATE PROCEDURE getBroker ()
RETURNS CHAR
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.Utils.getBrokername"; |
Corresponding JAVA method
Code: |
package com.ibm.broker;
import com.ibm.broker.plugin.*;
public class Utils {
/*
* Returns the name of the broker, which the flow is running on.
*/
public static String getBrokerName() {
String value = "error";
try {
MbNode mn = new MbNode();
MbBroker mb = mn.getBroker();
value = mb.getName();
} catch (MbException e) {
return value;
}
return value;
}
} |
titus wrote: |
Could anybody please tell me how to get Broker name and execution group name inside a message flow. This information is for error handling purpose |
|
|
Back to top |
|
 |
mverh |
Posted: Tue Apr 19, 2005 7:34 am Post subject: |
|
|
Voyager
Joined: 06 Mar 2002 Posts: 97
|
I went down the java procedure road here and ran into a problem, turns out what maximreality posted is not supported...here is what IBM L3 support came back with, note item 18:
1. A procedure cannot RETURN values of the ESQL reference data types.
2. All java function calls inside the external java routine should be
thread safe.
3. Each message flow is a thread and the java plug-in API should be used
only by the same thread that invokes the routine. Users are allowed to
spawn threads inside their routine, but should return control back to
the broker and these threads shouldn?t use the java plug-in APIs.
4. The Java routine shouldn?t throw any exceptions.
5. OUT parameters passed into a procedure (whether internal or external)
always contain a NULL value of the correct type when they are received
by the procedure. This happens irrespective of their value before the
CALL. IN and INOUT parameters can be NULL when received by the
procedure. When the procedure has completed, any parameters declared as
OUT or INOUT are updated to reflect any changes made to them during the
procedure's execution. Parameters defined as IN are never changed during
the cause of a procedure's execution. This enforces that the INOUT and
OUT variables get completely update only after the procedure
termination.
6. If the parameter data type of the CREATE PROCEDURE doesn?t match with
the java procedure target variables, then it would result only in a
runtime error.
7. Overloaded Java methods are supported ONLY by giving each procedure
declaration a different ESQL name.
8. Any changes made to the external routine become effective only after
the broker restart.
9. There is no on-the-fly deploy of the java classes like the message
flow deploys. Any changes made to the ESQL procedures can be effective
after the deploy but not the case with java procedures.
10. The optional brokerSchemaName parameter is not supported on WBIMB
v2.1 and earlier brokers. All ESQL that is deployed to a Version 2.1, or
earlier broker, must be defined in the same broker schema as the message
flow, that is the .
11. If users use the OUT parameter then it must not be of type
MbElement.
12. While using INOUT parameter, if a different MbElement is passed back
to the caller, then it must point into the same tree as it did on the
way in. Eg: If a reference to OutputRoot.XML.Top.A is passed in, and it
is moved around the tree in Java this is fine. The restriction is that
it MUST point to SOMEWHERE in OutputRoot still when it is returned (it
cannot be moved to a different tree).
13. Only Java scalar object wrappers are used. The ESQL scalar types are
mapped to Java datatypes as object wrappers or object wrapper arrays
depending on the direction of the ESQL parameter. The wrapper arrays
will only ever contain exactly one element. Object wrappers are used to
allow NULLs to be passed to and from Java methods.
14. All restrictions that apply to the usage of ?Java Plug-in API? do
also apply here.
15. Users should not perform any MQ or JMS Work.
16. If users intend to perform the database operations then only JDBC
Type 4 connections allowed. These operations will not be part of a
broker transaction.
17. Users shouldn?t perform any XA transactions inside these procedures.
18. Only MbDate, MbTime, MbTimeStamp, MbElement from the java plugin
APIs are allowed to be used inside the procedures.
In my case I could get broker name, eg name but when I tried to get flow name the DFE abended...
Marc Verhiel |
|
Back to top |
|
 |
waugh |
Posted: Tue Apr 19, 2005 10:12 am Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 225
|
Maximreality,
when i try to compile your java program from above post i am getting an error saying,
Utils.java:3: package com.ibm.broker.plugin does not exist
at line
import com.ibm.broker.plugin.*;
I remember i did full installation of the software. Is there a step i am missing? |
|
Back to top |
|
 |
EddieA |
Posted: Tue Apr 19, 2005 10:22 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
Is there a step i am missing |
Probably adding it to the CLASSPATH for the compile. It isn't added to the System CLASSPATH by the install.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
waugh |
Posted: Tue Apr 19, 2005 11:27 am Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 225
|
Thanks Eddie,
can you tell me where it is located? I cant seem to find it in search...
its not in
C:\Program Files\IBM\WebSphere Business Integration Message Brokers\lib
C:\Program Files\IBM\WebSphere Business Integration Message Brokers\jre\lib
Last edited by waugh on Tue Apr 19, 2005 11:31 am; edited 1 time in total |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Apr 19, 2005 11:28 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
waugh wrote: |
C:\Program Files\IBM\WebSphere Business Integration Message Brokers\lib |
Why would a Java class be in lib?
You need to add classes/jplugin.jar _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
waugh |
Posted: Tue Apr 19, 2005 12:24 pm Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 225
|
thanks guys,
i am now getting those same old errors....
BIP2498E: (.NEWLINE_Compute.getBroker, 1.4) : An error occured whilst trying to resolve the Java class / method 'com.ibm.broker.Utils.getBrokerName' referred to by the routine 'getBroker'.
BIP2943E: The Java Method 'com.ibm.broker.Utils.getBrokerName' could not be found as its containing class could not be found in the broker classpath
once again its in classpath and i can run it from command prompt.
I followed 1 of the 4 procedures from Information center and it is pasted below as it is.
-----------------------------------------------------------------------------------
You want to deploy the compiled Java class file without a jar, with the Java class not belonging to a Java package.
1. Add c:\mqsi; to the system CLASSPATH.
2. Place the myTest.class class file in the c:\mqsi directory. |
|
Back to top |
|
 |
mgk |
Posted: Tue Apr 19, 2005 2:21 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Did you follow the next step and reboot? _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
shrek |
Posted: Wed Apr 20, 2005 5:11 am Post subject: |
|
|
 Acolyte
Joined: 19 Feb 2005 Posts: 61 Location: Gudivada,India
|
Try adding your jar file in the "jplugin" diretory and restart your broker. I followed these steps
for example
1) put the jar file in the c:\mqsi
2) add c:\mqsi to classpath
3) place the jar file in jplugin directory.
I was successful once but then I added more methods in retrieve the execution group name and message flow name and then ran into some program exceptions.
see the below link
http://www.mqseries.net/phpBB2/viewtopic.php?t=21582
Let all of us know if you are successful. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 20, 2005 5:25 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
shrek wrote: |
see the below link |
Oooh.
Failure to resolve circular reference. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
waugh |
Posted: Wed Apr 20, 2005 6:51 am Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 225
|
mgk,
i rebooted system for each of those 4 procedures... all result in same errors.
I dont know what else to try?  |
|
Back to top |
|
 |
|