Author |
Message
|
apsy |
Posted: Mon Oct 11, 2004 8:14 am Post subject: Custom Java Node- plugin |
|
|
 Novice
Joined: 10 Feb 2004 Posts: 24
|
I have written a experimental custom Java node to read a file and load the contents into a HashMap .
Every time I change my java code , I stop my broker , export my new jar into /<wbimb installpath> /jplugin and re-start my broker.
I see that the constructor in my code gets executed.
e.g: myNode()
{ Note start time;
construct input and output terminals;
while not end of file
{
Read flat file ;
append to hashmap;
}
Note end time ;
Print out timetaken ;
}
Question 1) I see that the whole code block in the constructor gets executed twice. Why is that ?
Queston2 I wanted to use log 4 J for logging debug statements. I used the following lines of code to instantiate the log4 J within my Java Node.
PropertyConfigurator.configure("abc.properties");
dlogger = Logger.getLogger("com.sears.mds.dataLogger");
contents of abc.properties
log4j.appender.root_app1=org.apache.log4j.ConsoleAppender
log4j.logger.com.sears.dataLogger=DEBUG,dataLogger_app1
log4j.appender.root_app1.Threshold=DEBUG
log4j.appender.root_app1.layout=org.apache.log4j.PatternLayout
log4j.logger.com.text.samples.myLogger=DEBUG,dataLogger_app1
log4j.appender.dataLogger_app1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.dataLogger_app1.datePattern='.'yyyyMMdd
log4j.appender.dataLogger_app1.File=d:/logs/mds/myNodeLogger.log
log4j.appender.dataLogger_app1.layout=org.apache.log4j.PatternLayout
It seems to me like the property configurator works, but there seems to be a clash between the
mynode.properties file that gets created when I initially configured my node in the toolkit .
contents of mynode.properties
#This is a generated file.
#The values in this file have syntax: key = value
#User modifications to the values in this file will be preserved
#Wed Oct 06 09:51:37 CDT 2004
OutTerminal.out=out
myNode=myNode
InTerminal.in=in
OutTerminal.failure=failure
As a result, I get errors when I try to deploy my flow.
I tried to edit this file to include my log4j configurations. The editor would not save my changes.
Am I doing something wrong?
Question3 ) If I use MbService API to log my messages, it by default logs it to the wbimb system log. Is this an asynchronous call?.
Question 4If I wanted to re-direct the output messages to a different log , and keep the logging asynchronous, what do I do ?
Thanks
Apsy |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Oct 11, 2004 8:40 am Post subject: Re: Custom Java Node- plugin |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
apsy wrote: |
Question 1) I see that the whole code block in the constructor gets executed twice. Why is that ? |
Two execution groups? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
apsy |
Posted: Mon Oct 11, 2004 8:51 am Post subject: |
|
|
 Novice
Joined: 10 Feb 2004 Posts: 24
|
Nope. Just one execution group |
|
Back to top |
|
 |
kirani |
Posted: Mon Oct 11, 2004 11:15 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Is this a plug-in Input node or normal processing node?
Quote: |
A Java User-defined message processing node is instantiated when a broker deploys a message flow containing the user-defined message processing node. When the node is instantiated, the constructor of the message processing node’s class is called.
|
Do you have multiple instances set for this message flow? _________________ 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 |
|
 |
apsy |
Posted: Mon Oct 11, 2004 12:51 pm Post subject: |
|
|
 Novice
Joined: 10 Feb 2004 Posts: 24
|
This is a message processing node.There is just one instance of this node deployed in one execution group |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Oct 11, 2004 1:11 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
apsy wrote: |
This is a message processing node.There is just one instance of this node deployed in one execution group |
Does that single message flow have more than one instance running? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
apsy |
Posted: Mon Oct 11, 2004 1:14 pm Post subject: |
|
|
 Novice
Joined: 10 Feb 2004 Posts: 24
|
Its one message flow, with just one running instance. |
|
Back to top |
|
 |
|