Author |
Message
|
lonesheep |
Posted: Mon Oct 09, 2017 7:15 am Post subject: User Defined (Java) |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
Hi,
Is there a end to end tutorial anyway on creating user defined Java nodes in IIB 10?
I see there appears to be a wizard which generates a class which defines the input/output connections etc which extends Node....however I cannot find any information on how to implement this generated class or what to do with it.
Many thanks |
|
Back to top |
|
 |
lonesheep |
Posted: Wed Oct 11, 2017 11:03 am Post subject: |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
really nothing!
I've progressed with that I could find online using the looping IBM help pages (I found some information under WebSphere 8 - so quite old).
Currently I've managed to create a user defined broker node, as long as it has no parameters. As soon as I add a parameter (i.e. a string called "Path") and amend the implementation class to include a getPath and setPath, I get the following error when trying to deploy the message flow;
The integration node received a configuration message containing the attribute name 'Path' which is not valid for the target object
I'm at a loss and can't get this to work. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 11, 2017 12:19 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
lonesheep |
Posted: Wed Oct 11, 2017 1:34 pm Post subject: |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
Not being funny, but I have read all this (and gone around the looping within the IBM help site). I've written a plugin on IIB 9without issue....just not in IIB 10.
Having worked 20+ years with Microsoft Technologies, I'm surprised there is no "download this example"....which I'd normally be presented with. To be honest I'm surprised all this IBM stack is shrouded in mystery...but I suppose it is not in IBM's interest to publish a lot of information on it as the most of there income comes from consultancy. If only the company I worked for gave training!.......still maybe this is a opportunity to leave! |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Oct 12, 2017 4:07 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Well. I wasn't trying to be funny either.
The error you are getting says that the node you have deployed doesn't have the properties you have defined.
That's usually a mismatch between the node functions (the get/set) in the node proejct and the ui node project.
So, there are two projects. one for UI and one for runtime.
It's been a while since I've written a user defined node (IIB v7 maybe?). I thought the UI project had some kind of fancy editor thingy for the node properties...
Generally, there are samples/templates/whatever for IIB topics. I don't know where they are in v10.0, and I don't know if they include a user-defined node, but there used to be a user-defined node template thingy. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
Vitor |
Posted: Thu Oct 12, 2017 4:57 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Generally, there are samples/templates/whatever for IIB topics. I don't know where they are in v10.0, and I don't know if they include a user-defined node, but there used to be a user-defined node template thingy. |
IIRC, one of the ways the IIBv10 Developer Edition install was made smaller was by not packaging the samples / templates with the software but putting them up on GitHub.
I'd look, but the lease on my old laptop expired and they've "refreshed" me.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
lonesheep |
Posted: Thu Oct 12, 2017 6:35 am Post subject: |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
I'm using the IIB 10.0.0.8 developer edition.
I've stripped everything down to absolute basics.
Created a UDN project and generated a UDN in there with one property under "Basic" called "AttName".
Create an Java project to implement this UDN.
Code: |
public class testNode extends MbNode implements MbNodeInterface {
private String tracingLevel = "";
public static String getNodeName() {
return "testNode" ;
}
<an... public void evaluate(MbMessageAssembly assembly, MbInputTerminal..{} >
public String getAttName() {
return tracingLevel;
}
public void setAttName(String value) {
this.tracingLevel = value;
}
}
|
Stopped the broker.
Compiled the implementation code and copied it to my LIL folders
Started the broker
Selected "Run in new Workbench" for the UDN project.
The UDN is listed in the menu. I can drag it out and use it in a flow.
If I make no changes to the UDN node properties all works OK when I deploy. However, should I amend a property on the node and deploy I get the error...
BIP2210E: Invalid configuration message: attribute name 'AttName' not valid for target object 'gen.operation1_Request_Response.Test Node'. |
|
Back to top |
|
 |
lonesheep |
Posted: Thu Oct 12, 2017 12:00 pm Post subject: None working sample |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
I've created a workspace with what I have created to demonstrate the issue I'm having. I hope I'm just missing something out.
The workspace can be retrieved from here (its for IIB 10).
http://www.darkangel.me/workspace_udn.zip
Two projects;
Sample - The UDN project
SampleNodeImpl - The implementation
I export the SampleNodeImpl as a JAr and copy this to an LIL folder "c:\brokerplugins" I created using;
mqsichangebroker TESTNODE -l C:\brokerplugins
I then test the flow by going to the Sample UDN project and selecting "Run in new workbench"
I create a new Integration service and add the UDN node from the toolbox into the flow. Amend the value of "FirstAttribute" in the "Sample" and attempt to deploy the to the broker....
ERROR
BIP2210E: Invalid configuration message: attribute name 'FirstAttribute' not valid for target object 'gen.operation1_Request_Response.Sample'.
I'm at a loss....any help greatly appreciated. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Oct 12, 2017 12:11 pm Post subject: Re: None working sample |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lonesheep wrote: |
I'm at a loss....any help greatly appreciated. |
On that basis I'll show my lack of Java knowledge and offer this:
lonesheep wrote: |
I export the SampleNodeImpl as a JAr and copy this to an LIL folder "c:\brokerplugins" I created using; |
To me, an .lil file is what you get from a C-based node. I'd be surprised if that's the correct folder for a JAR file. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
lonesheep |
Posted: Thu Oct 12, 2017 1:23 pm Post subject: |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
A jar file seems to ben invoked from the LIL path, I placed some code to write to a file in the constructor and this is invoked as the file is created.
The broker also grabs a lock on the file...so I'm happy the jar is loaded from the LIL path.
TO be on the safe side, I also copied the java implementation Jar to the java library path at C:\Program Files\IBM\IIB\10.0.0.9\server\jplugin. The issue is still present. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Oct 13, 2017 4:22 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I'm going to take a wild stab here and guess that you are having classloader problems.
The knowledge center recommends that you create a new LIL directory, and put stuff there. It also gives instructions on making sure that the classpath knows about that directory.
Stuff loaded by the system classloader (which lods things from the default lil file) probably aren't available in the places you're trying to use them from.
there's a KC page somewhere that shows the classloader hierarchy.
I've not posted links because I forget where they are. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
lonesheep |
Posted: Fri Oct 13, 2017 11:28 am Post subject: |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
I copied the jar file over to the broker shared-classes folder in;
C:\ProgramData\IBM\MQSI\config\TESTNODE\shared-classes
Still get the same issue. I have absolutely no idea why and the BIP error returned is a generic one! Even installed the latest service pack in the hope that would fix it! |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Oct 15, 2017 12:45 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
... shared classes isn't the right place either... The link was specific about creating a new folder and adding that to the lil path.
I know the last time I tried to do stuff with user defined nodes, I had to take this step or things just wouldn't work.
shared classes is for java compute node class dependencies.
I'm sure someone around has done stuff with user defined nodes in v10, but I'd suggest two things.
One, open a PMR.
Two, look at the connector api. I don't know if that's only for talking over transports not provided, but it might not be. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
lonesheep |
Posted: Thu Dec 07, 2017 11:17 am Post subject: |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
I finally figured out the issue.
In the broker message UI toolkit I had to give the property names all lower case names, otherwise the toolkit wouldn't marry up the property names to the Java properties.
ie.
In the UI the property
"path"
needs to map to the Java
getpath
If the "path", was "Path" it never works. Funny as this was not the case in IIB9. |
|
Back to top |
|
 |
MKHODER |
Posted: Wed Dec 27, 2017 5:05 am Post subject: UDP value is Null |
|
|
Newbie
Joined: 27 Dec 2017 Posts: 7
|
Hello everyone,
I created a java node that contains UDP Url :
- Built-in : String
- Default Value : defaultUrl
- Custom Compiler Class : empty value
- Custom EditorClass : empty value
- Mandatory : true
- Configurable : true
Code: |
protected final static String PROPERTY_URL = "Url";
public String getUrl() {
return (String)getPropertyValue(BasicPropertiesNodeUDN.PROPERTY_URL);
} |
In my project java I redefined the accessors of my property
Code: |
public class BasicPropertiesNode extends MbNode implements MbNodeInterface {
public String Url="";
public BasicPropertiesNode() throws MbException {
// TODO Auto-generated constructor stub
createInputTerminal("in");
createOutputTerminal("out");
createOutputTerminal("failure");
createOutputTerminal("catch");
}
public void evaluate(MbMessageAssembly contact admin, MbInputTerminal inputTerminal) throws MbException {
MbMessage outMessage = new MbMessage();
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin, outMessage);
MbElement outRoot = outMessage.getRootElement().createElementAsLastChild("XML");
MbElement Employee = outRoot.createElementAsFirstChild(MbElement.TYPE_NAME,"Message",null);
MbElement EmpName = Employee.createElementAsLastChild(MbElement.TYPE_NAME,"UrlElement",Url);
}
public String getUrl() {
return Url;
}
public void setUrl(String Url) {
this.Url = Url;
}
|
My problem is the value of my element UrlElement in the XML message is empty, could you help me? Is there more to do?
thanks in advance. |
|
Back to top |
|
 |
|