ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker SupportUser Defined Nodes (Java) limitation...getExceptionList()

Post new topicReply to topic
User Defined Nodes (Java) limitation...getExceptionList() View previous topic :: View next topic
Author Message
lonesheep
PostPosted: Tue Feb 13, 2018 8:11 am Post subject: User Defined Nodes (Java) limitation...getExceptionList() Reply with quote

Novice

Joined: 12 Sep 2017
Posts: 20

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
View user's profile Send private message
abhi_thri
PostPosted: Wed Feb 14, 2018 12:29 am Post subject: Reply with quote

Disciple

Joined: 17 Jul 2017
Posts: 180
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
View user's profile Send private message
lonesheep
PostPosted: Wed Feb 14, 2018 1:34 am Post subject: Reply with quote

Novice

Joined: 12 Sep 2017
Posts: 20

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
View user's profile Send private message
fjb_saper
PostPosted: Wed Feb 14, 2018 6:40 am Post subject: Re: User Defined Nodes (Java) limitation...getExceptionList( Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19684
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
View user's profile Send private message Send e-mail
rekarm01
PostPosted: Wed Feb 14, 2018 10:18 am Post subject: Re: User Defined Nodes (Java) limitation...getExceptionList( Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1298

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
View user's profile Send private message
lonesheep
PostPosted: Mon Feb 19, 2018 4:21 am Post subject: Reply with quote

Novice

Joined: 12 Sep 2017
Posts: 20

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
View user's profile Send private message
lonesheep
PostPosted: Mon Feb 19, 2018 5:15 am Post subject: Reply with quote

Novice

Joined: 12 Sep 2017
Posts: 20

Cool I got it now.

I have to recursively parse the content in inExceptionList.getRootElement() to get the information.

Many thanks
Back to top
View user's profile Send private message
rekarm01
PostPosted: Tue Feb 20, 2018 11:37 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1298

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
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportUser Defined Nodes (Java) limitation...getExceptionList()
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.