Author |
Message
|
lonesheep |
Posted: Tue Feb 13, 2018 8:11 am Post subject: User Defined Nodes (Java) limitation...getExceptionList() |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
Hi,
I know there are limitations of what you can/can't do in a Java user defined node. I'm trying to find a definitive list.
I'm current trying to access the ExceptionList trace, but it always seems to be empty even though the ExceptionList contains values on the connection proceeding the UDN (at least I can see it in debug mode on the message flow).
However, when entering the Java on the UDN;
final MbMessage inException = assembly.getExceptionList();
appears to yield nothing.
Any ideas?
Many thanks |
|
Back to top |
|
 |
abhi_thri |
Posted: Wed Feb 14, 2018 12:29 am Post subject: |
|
|
 Knight
Joined: 17 Jul 2017 Posts: 516 Location: UK
|
Is it just the ExceptionList you are having trouble with, for eg:- are you able to access the message body fine?
Also worth checking whether it is case of ExceptionList object is extracted as expected to inException but further processing is failing (eg:- if you are evaluating on the exception object to extract details by Xpath or so) |
|
Back to top |
|
 |
lonesheep |
Posted: Wed Feb 14, 2018 1:34 am Post subject: |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
its just the exceptionlist which is causing me problems.
The message body seems fine.
@Override
public void evaluate(MbMessageAssembly assembly, MbInputTerminal inTerminal) throws MbException {
final MbMessage inMessage = assembly.getMessage();
byte[] msgAsByte2s = inMessage.getRootElement().toBitstream(
null, null, null, 0, 1208, 0);
String messageBody = new String(msgAsByte2s, "UTF-8");
The messageBody is populated as I'd expect. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Feb 14, 2018 6:40 am Post subject: Re: User Defined Nodes (Java) limitation...getExceptionList( |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
lonesheep wrote: |
Hi,
I know there are limitations of what you can/can't do in a Java user defined node. I'm trying to find a definitive list.
I'm current trying to access the ExceptionList trace, but it always seems to be empty even though the ExceptionList contains values on the connection proceeding the UDN (at least I can see it in debug mode on the message flow).
However, when entering the Java on the UDN;
final MbMessage inException = assembly.getExceptionList();
appears to yield nothing.
Any ideas?
Many thanks |
Explain appears to yield nothing...
Do you use inException.getRootElement()?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Feb 14, 2018 10:18 am Post subject: Re: User Defined Nodes (Java) limitation...getExceptionList( |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
lonesheep wrote: |
Code: |
final MbMessage inMessage = assembly.getMessage();
byte[] msgAsByte2s = inMessage.getRootElement().toBitstream(null, null, null, 0, 1208, 0); |
|
A user-defined node usually calls toBitstream() for the last child of Root, not for Root itself.
lonesheep wrote: |
Code: |
final MbMessage inException = assembly.getExceptionList(); |
|
So far, so good. What comes after that?
ExceptionList does not have a parser associated with it, so toBitstream() won't work the same way it did for Root. |
|
Back to top |
|
 |
lonesheep |
Posted: Mon Feb 19, 2018 4:21 am Post subject: |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
The joys of using snippets of code.
I've placed a break-point before my user defined node, in the IIB Variables I can see the contents of the Exception List.
In my user defined node, i have the following;
final MbMessage inMessage = assembly.getMessage();
final MbMessage inExceptionList = assembly.getExceptionList();
String message = convertMessageToString(inMessage);
String errorMessage = convertMessageToString(inExceptionList);
where convertMessageToString is defined as;
private String convertMessageToString(MbMessage message) throws UnsupportedEncodingException, MbException {
byte[] msgAsByte2s = message.getRootElement().toBitstream(
null, null, null, 0, CCSID, 0);
return new String(msgAsByte2s, "UTF-8");
}
message is what I expect (the message contents), whereas errorMessage is a zero length string. I expected the contents of ExceptionList as the IIB displayed it. |
|
Back to top |
|
 |
lonesheep |
Posted: Mon Feb 19, 2018 5:15 am Post subject: |
|
|
Novice
Joined: 12 Sep 2017 Posts: 21
|
Cool I got it now.
I have to recursively parse the content in inExceptionList.getRootElement() to get the information.
Many thanks |
|
Back to top |
|
 |
rekarm01 |
Posted: Tue Feb 20, 2018 11:37 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
lonesheep wrote: |
The joys of using snippets of code. |
... and don't forget the joys of using [code] tags to separate the snippets of code from the surrounding text.
lonesheep wrote: |
I have to recursively parse the content in inExceptionList.getRootElement() to get the information. |
That is one of the more common ways to get that information. |
|
Back to top |
|
 |
|