|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JAVA PLUG-IN NODE WMQSI 2.1 |
« View previous topic :: View next topic » |
Author |
Message
|
danielaphex |
Posted: Tue Jan 13, 2004 9:25 am Post subject: JAVA PLUG-IN NODE WMQSI 2.1 |
|
|
Apprentice
Joined: 07 Apr 2003 Posts: 28
|
I am trying to develop a PlugIn Node in Java language and I have some doubts I would like to be solved:
About Documentation...
1) Is there any specific document about this particular without considering the 'WMQSI Programming Guide'??
About installation on Broker Machine
1) If my Java class is called, for example, PlugInClass, is it mandatory to call my exported .jar file of the same way (ie: PlugInClass.jar)?
2) If my Java class is within a package, for example, com.ibm.samples, do I have to create this directory structure (com + ibm + samples) under /install_dir/jplugin and place the jar file on it or, nevertheless, the rigth place to put it on is on /install_dir/jplugin without package considerations??
3) Which skills of authorization are required for the jar file to make it visible to the broker?
About integrating the Node in WMQSI Control Center?
1) Is it mandatory to call the Node in the Control Center of the same way than I did in the method getNodeName of the associated Java program?
2) When we are asked about the package name in the Control Center PLugIn Window, is this name just the package name (com.ibm.samples) or it is needed to add the jar file name (ie:com.ibm.samples.PlugInClass.jar)
As you can see I am a little bit lost about this so whatever aim of help will be very wellcome.
Thanks in advance, |
|
Back to top |
|
 |
kirani |
Posted: Tue Jan 13, 2004 10:22 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
danielaphex wrote: |
About Documentation...
1) Is there any specific document about this particular without considering the 'WMQSI Programming Guide'??
|
You can refer to IBM Redbooks WMQI Deployment and Migration and Developing Solutions with WMQI. In these books you will find some sample code for java plug-in nodes.
danielaphex wrote: |
About installation on Broker Machine
1) If my Java class is called, for example, PlugInClass, is it mandatory to call my exported .jar file of the same way (ie: PlugInClass.jar)?
|
Yes.
danielaphex wrote: |
2) If my Java class is within a package, for example, com.ibm.samples, do I have to create this directory structure (com + ibm + samples) under /install_dir/jplugin and place the jar file on it or, nevertheless, the rigth place to put it on is on /install_dir/jplugin without package considerations??
|
No, you don't need to create the directory structure when placing the jar file in /install_dir/jplugin directory. But your source code needs to have the directory structure when building the jar file.
danielaphex wrote: |
3) Which skills of authorization are required for the jar file to make it visible to the broker?
|
You don't need any special authorizations. Please make sure the Broker service-user-id has access to the file.
danielaphex wrote: |
About integrating the Node in WMQSI Control Center?
1) Is it mandatory to call the Node in the Control Center of the same way than I did in the method getNodeName of the associated Java program?
|
Yes.
danielaphex wrote: |
2) When we are asked about the package name in the Control Center PLugIn Window, is this name just the package name (com.ibm.samples) or it is needed to add the jar file name (ie:com.ibm.samples.PlugInClass.jar)
|
It should be com.ibm.samples only. _________________ 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 |
|
 |
danielaphex |
Posted: Wed Jan 14, 2004 12:44 am Post subject: |
|
|
Apprentice
Joined: 07 Apr 2003 Posts: 28
|
Thanks very much Kiran,
Quote: |
danielaphex wrote:
2) If my Java class is within a package, for example, com.ibm.samples, do I have to create this directory structure (com + ibm + samples) under /install_dir/jplugin and place the jar file on it or, nevertheless, the rigth place to put it on is on /install_dir/jplugin without package considerations??
No, you don't need to create the directory structure when placing the jar file in /install_dir/jplugin directory. But your source code needs to have the directory structure when building the jar file. |
When you say that my source code needs to have the directory structure, do you mean It is mandatory to write a code like this in my Java class??
package install_dir.jplugin;
Thanks in advance, |
|
Back to top |
|
 |
kirani |
Posted: Wed Jan 14, 2004 11:37 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
No, I was trying to say that you should create a directory structure locally, for example, create directory c:\plug-in\com\ibm\sample\ and then your source file will reside in this directory. You can then create the jar file by going to C:\plug-in directory. _________________ 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 |
|
 |
danielaphex |
Posted: Thu Jan 15, 2004 10:03 am Post subject: PROBLEMS WITH PLUGIN NODE |
|
|
Apprentice
Joined: 07 Apr 2003 Posts: 28
|
Hi friends,
due to I was having problems with my Java plugin node configuration I decided just to copy an example from WMQSI installation to test the way to implement this configuration.
As you can imagine, this experiment was not as successful as expected.
I am going to show you all the steps I gave:
JAVA PROGRAMMING
1) I took the Java node SwitchNode.java from WMQSI and I compiled.
The source code I used is the following:
Quote: |
/*
* Licensed Materials - Property of IBM
* 5648-C63
* (C) Copyright IBM Corp. 1999, 2001
*/
package com.ibm.samples;
import com.ibm.broker.plugin.*;
/**
* Sample plugin node.
* This node propagates the incoming message to one of several output terminals
* depending on the content of the message.
* A minimal test message for this node would be:
* <data><action>change</action></data>
*/
public class SwitchNode extends MbNode implements MbNodeInterface
{
String _nodeTraceSetting;
/**
* Switch node constructor.
* This is where input and output terminal are created.
*/
public SwitchNode() throws MbException
{
createInputTerminal("in");
createOutputTerminal("add");
createOutputTerminal("change");
createOutputTerminal("delete");
createOutputTerminal("hold");
createOutputTerminal("failure");
}
/**
* This static method is called by the framework to identify this node.
* If this method is not supplied, a default name will be generated
* automatically based on the node's package/class name. In this case
* it would be 'ComIbmSamplesSwitchNode'.
*/
public static String getNodeName()
{
return "SendMailNode";
}
/**
* This evaluate message is called by the broker for each message passing
* through the flow. The message assembly is passed in with the 'assembly'
* parameter. It is possible for a node to have more than one input
* terminal. The terminal that the message has come in on is represented
* by the 'in' parameter.
*/
public void evaluate(MbMessageAssembly assembly, MbInputTerminal in)
throws MbException
{
// Navigate to the relevant syntax element in the XML message
MbElement rootElement = assembly.getMessage().getRootElement();
MbElement switchElement = rootElement.getLastChild().getFirstChild().getFirstChild();
// To aid debugging, text can be printed to stdout/stderr.
// On NT this can be viewed by selecting 'Allow sevice to interact with
// desktop' on the NT Services properties dialog.
// On Unix set the environment variable MQSI_RUN_ATTACHED=1 before
// starting the broker.
if(_nodeTraceSetting.equals("debug"))
{
System.out.println("Element = " + switchElement.getName());
System.out.println("Value = " + switchElement.getValue());
}
// Select the terminal indicated by the value of this element
String terminalName;
String elementValue = (String)switchElement.getValue();
if(elementValue.equals("add"))
terminalName = "add";
else if(elementValue.equals("change"))
terminalName = "change";
else if(elementValue.equals("delete"))
terminalName = "delete";
else if(elementValue.equals("hold"))
terminalName = "hold";
else
terminalName = "failure";
MbOutputTerminal out = getOutputTerminal(terminalName);
// Now propagate the message assembly.
// If the terminal is not attached, an exception will be thrown. The user
// can choose to handle this exception, but it is not neccessary since
// the framework will catch it and propagate the message to the failure
// terminal, or if it not attached, rethrow the exception back upstream.
out.propagate(assembly);
}
/* Attributes are defined for a node by supplying get/set methods.
* The following two methods define an attribute 'nodeTraceSetting'.
* The capitalisation follows the usual JavaBean property convention.
*/
public String getNodeTraceSetting()
{
return _nodeTraceSetting;
}
public void setNodeTraceSetting(String nodeTraceSetting)
{
_nodeTraceSetting = nodeTraceSetting;
}
}
|
2) I created the jar file calling it 'SwitchNode.jar'
BROKER CONFIGURATION
3) I stopped the broker
4) I set the environment variables for the broker machine (an AIX) called 'MQSI_RUN_ATTACHED=1' and I gave it the value of 1
5) I copied the jar file commented above ('SwitchNode.jar') in directory /install_dir/jplugin
6) I started the Broker
CONTROL CENTER INTEGRATION
7) I created a Plug-In Node and a Message Flow which contains it.
The most significatives parameters I set, were:
a) Node Name -> SendMailNode
b) Node Identifier -> SendMail
c) I defined 6 terminals ('in' for input and 'add', 'change', 'delete', 'hold' and 'failure' for output)
d) I defined a very simple message flow consisting in an input Node and 5 output nodes each one pointing to a predefinided MQSeries Queue.
e) I connected all the terminal with their respective nodes
f) I placed the MessageFlow on a execution group
g) I deployed that E.G
I tried the message Flow by putting the following message
Quote: |
<data><action>add</action></data> |
9) The execution did not work as expected and the following exception appear:
Quote: |
Jan 15 18:58:23 eaidesa WMQIv210[75786]: (EAIBKDESA1_BK.Grupo_DPG)[2834]BIP2230E
: Error detected whilst processing a message in node 'PlugInFirst_1.SendMailNode
1'. : EAIBKDESA1_BK.3967f6c1-f900-0000-0080-cfb54220f4dc: /build/S210_P/src/Data
FlowEngine/PluginInterface/ImbJniNode.cpp: 843: ImbJniNode::evaluate: ComIbmJniN
ode: 64d3891a-fa00-0000-0080-f0d07303466e
Jan 15 18:58:23 eaidesa WMQIv210[75786]: (EAIBKDESA1_BK.Grupo_DPG)[2834]BIP4367E
: The method 'evaluate' in Java node 'SendMailNode1' has thrown the following ex
ception: java.lang.NullPointerException. : EAIBKDESA1_BK.3967f6c1-f900-0000-0080
-cfb54220f4dc: /build/S210_P/src/DataFlowEngine/PluginInterface/com_ibm_broker_p
lugin_CMbService.cpp: 1429: throwableToNativeException: : |
And I did not obtain any stdout or stderr file on Broker Machine.
I do not know wether I missed to follow any step or not.
Anyway I would be very pleased if someone could help me with this issue.
Thanks in advance.. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 15, 2004 10:40 am Post subject: Re: PROBLEMS WITH PLUGIN NODE |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
danielaphex wrote: |
The most significatives parameters I set, were:
a) Node Name -> SendMailNode
b) Node Identifier -> SendMail
|
It's been a while since I've done this, but I'm pretty sure one of these two (and probably the Node Identifier) has to be the fully qualified classname of your node. So, "com.ibm.samples.SwitchNode" in your case.
There is an excellent example of creating and deploying a custom Java plug-in in the Redbook "Developing Solutions with WebSphere MQ Integrator". I highly recommend you find that and read the entire chapter on Java nodes. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
danielaphex |
Posted: Fri Jan 16, 2004 12:49 am Post subject: |
|
|
Apprentice
Joined: 07 Apr 2003 Posts: 28
|
Quote: |
There is an excellent example of creating and deploying a custom Java plug-in in the Redbook "Developing Solutions with WebSphere MQ Integrator". I highly recommend you find that and read the entire chapter on Java nodes.
|
I really have read the book you are talking about...
But anyway, following the steps of the book I am having the problem I related in our previous comunication
I hope someone could help me..
Cheers, |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|