Author |
Message
|
marco |
Posted: Mon Aug 22, 2005 6:19 am Post subject: Java Input Node |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
Hi,
does anyone have an efficient & elegant way to handle an MbBrokerException ?
Currently I just log that there was an error and try to push the message to the failure terminal.
Tx
Marco |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Aug 22, 2005 6:24 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I guess this depends on what you mean by "handle".
In my opinion, an input node should make sure to produce as much information as possible about failures with the input source in question and try to make that information as useful as possible. So, for example, returning the input source error message and etc.
Also, the docs for MbBrokerException says
Quote: |
An MbBrokerException is thrown when an interal error occurs in the broker. Normal MbBrokerExceptions are not caught and will be passed back to the broker. However, if they are caught by user code they must be rethrown to the broker for additional error recovery to be performed. |
(not my emphasis) _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
recallsunny |
Posted: Mon Aug 22, 2005 9:13 am Post subject: |
|
|
 Disciple
Joined: 15 Jun 2005 Posts: 163 Location: Massachusetts
|
The way we do it is, Log the complete Exception trace to a Log file using apache-log4j and then throw the exception back to the broker for any additional error recovery steps.
We have a process monitoring the Log file for further notifications/page's. |
|
Back to top |
|
 |
marco |
Posted: Wed Aug 24, 2005 12:00 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
Tx for the input and sorry for the late reaction ...
Throw the exception seems like the perfect thing to do, but how can I do this ? The signature of the run method only allows to throw an MbException
public synchronized int run(MbMessageAssembly assembly) throws MbException |
|
Back to top |
|
 |
marco |
Posted: Wed Aug 24, 2005 1:23 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
I just now tried it like this :
catch(MbBrokerException mbbrkex)
{
log("MbBrokerException occured : "+mbbrkex.getMessage());
if (catchTerminal.isAttached())
{
catchTerminal.propagate(newMsgAssembly);
log(" Message propagated to catch terminal ");
}
throw mbbrkex;
}
it seems to work, but I'm not getting the exception tree in the catch handling. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 24, 2005 3:15 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Do you get "Message propagated to catch terminal" in your log?
Did you augment newMsgAssembly with the exception tree?
Maybe you should just throw the exception and let the broker propagate to the catch terminal. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
marco |
Posted: Wed Aug 24, 2005 4:49 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
Indeed,
just catching and rethrowing the exception did the trick !!!
The broker automatically propagates to the catch terminal.
Thanks !!!!
I have a small side-question, when getting a message from a queue, with my own inputnode, I just can't seem to put the message on an outputQueue with the "pass-all" option.
"Set all" works perfectly, but I just think it's odd, because I open the queue correctly :
openOptions = MQC.MQOO_INPUT_AS_Q_DEF+MQC.MQOO_SAVE_ALL_CONTEXT+MQC.MQOO_FAIL_IF_QUIESCING;
Has anyone seen this before ? |
|
Back to top |
|
 |
|