Author |
Message
|
lium |
Posted: Mon Sep 23, 2013 5:08 am Post subject: disable TimeoutNotification node in Automatic mode |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
I have a business requirement to initialize the message flow before the first message comes in.
I think I can use TimeoutNotification node in Automatic mode to generate the first trigger message to initialize. however, I want to ignore the afterwards message.
Of course, I can set very long time interval or use logic to filter out any but the first message.
However, I am wondering if I can disable the node when the first message comes in since I don't want the message flow invoked after the first message.
Thanks, |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Sep 23, 2013 5:09 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
This is like the third time someone has asked this question in the last week.
Consider overriding the Constructor in a JCN. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Sep 23, 2013 5:26 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
lancelotlinc wrote: |
Consider overriding the Constructor in a JCN. |
If you want an example of why people who can write ESQL can't automatically write (good) Java then this is a good one to start with! _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Sep 23, 2013 5:39 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Maybe it's just me, but it seems much easier to just RETURN FALSE; in the appropriate situation than to worry about whether the timeoutnode is active or not. |
|
Back to top |
|
 |
lium |
Posted: Mon Sep 23, 2013 6:11 am Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
Thanks for reply
For
Quote: |
Consider overriding the Constructor in a JCN. |
I am wondering if this is to go with user-defined node. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Sep 23, 2013 6:43 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
lium wrote: |
Thanks for reply
For
Quote: |
Consider overriding the Constructor in a JCN. |
I am wondering if this is to go with user-defined node. |
No, not user-defined node. JCN = Java Compute Node. The suggestion is to override the constructor for the child class of MbJavaComputeNode class you defined already. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
lium |
Posted: Mon Sep 23, 2013 7:00 am Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
I am sorry but I am little confused with the term "Constructor".
Are you suggesting I override the evaluate() method or
provide public void MbJavaComputeNode().
If you refer to provide public void MbJavaComputeNode(), then My understanding is: I should provide a variable in instance level to flag if it has been sent or not?
If going with instance variable, I do not have to invoke public void MbJavaComputeNode()
Could you please kindly clarify more?
Thanks, |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Sep 23, 2013 7:13 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
lium |
Posted: Mon Sep 23, 2013 7:21 am Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
I know what is constructor, but I am confused with your methodology you mentioned.
I constructed the following code which works well, however, could you please clarify if this is what you mentioned:
import com.ibm.broker.javacompute.MbJavaComputeNode;
import com.ibm.broker.plugin.*;
public class CheckUserBalance_Initialize extends MbJavaComputeNode {
private boolean sent = false;
public void evaluate(MbMessageAssembly assembly) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");
MbMessage message = assembly.getMessage();
// ----------------------------------------------------------
// Add user code below
// End of user code
// ----------------------------------------------------------
// The following should only be changed
// if not propagating message to the 'out' terminal
if (!sent)
{
sent = true;
out.propagate(assembly);
}
}
} |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Sep 23, 2013 7:25 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
lium |
Posted: Mon Sep 23, 2013 7:49 am Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
Thanks for reply.
I think the onInitialize() works for lazy initialize. That is to say, before the first message is processed, It will finish initialization.
however, this lazy initialization will take longer time for processing the first message, which we want to avoid.
BTW, how can i get the MbJavaComputeNode constructor parameter list()?
I googled that, and could not find it. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Sep 23, 2013 8:42 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
You could try the constructor with zero parms, I cannot find reference either using Google.
The last time I did this, was related to pursuing a self-built in-memory cache in 2010 using a Singleton pattern. Since MB8, have no need to use anything other than the GlobalCache.
Keep poking at it till you get it to work for you. You are very close to solving. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
lium |
Posted: Mon Sep 23, 2013 9:23 am Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
Thanks for your reply.
I played the onInitialize(), this will get invoked every time the message flow starts or it is deployed. So it might not be that lazy.
Actually, I am trying to implement cache, right now, I used TimeoutNotification node in Automatic mode with long interval + JCN which will load cache data from external files.
So far it goes well.
I don't like the GlobalCache option, which seems to have dependency on WebSphere extreme |
|
Back to top |
|
 |
Simbu |
Posted: Mon Sep 23, 2013 9:37 am Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Sep 23, 2013 9:42 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
lium wrote: |
Thanks for your reply.
I played the onInitialize(), this will get invoked every time the message flow starts or it is deployed. So it might not be that lazy.
Actually, I am trying to implement cache, right now, I used TimeoutNotification node in Automatic mode with long interval + JCN which will load cache data from external files.
So far it goes well.
I don't like the GlobalCache option, which seems to have dependency on WebSphere extreme |
You really re-invented the wheel, but yours is much more square. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|