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 Index » WebSphere Message Broker (ACE) Support » Best way to discard messages in Java Compute Node post parse

Post new topic  Reply to topic
 Best way to discard messages in Java Compute Node post parse « View previous topic :: View next topic » 
Author Message
DevNYC1
PostPosted: Tue Apr 25, 2017 7:13 am    Post subject: Best way to discard messages in Java Compute Node post parse Reply with quote

Apprentice

Joined: 22 Aug 2012
Posts: 32

So my JCN is reading and parsing XML messages off the queue.

Only about 10% of the messages are the ones I care about. Once I parse a certain ID element of each message with XPath I know whether this is the message I need to process further, or just ignore and move to the next message.

In terms of numbers, about 27K messages hit that queue, and I am interested in about 2.5K messages that I further process.

Question: what is the best way from design/Good Practices point of view to discard the messages I don't need to take any further action on?

Seems that I can just add a return statement in my evaluate() once I know that this message can be discard. Since my MQInput is not transactional, that message will be discarded by default.

Is that the right way, though?

Let's assume I don't need to store, back up/archive these messages I am about to discard.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 25, 2017 7:42 am    Post subject: Re: Best way to discard messages in Java Compute Node post p Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

DevNYC1 wrote:
So my JCN is reading and parsing XML messages off the queue.


I do hope you don't mean you're parsing the XML with a JCN; rather, that you're examining the message tree produced by the in-built parser associated with the very expensive IBM software you're using.

If you just want to parse XML with Java, you can do it in WAS for a fraction of the price.....

DevNYC1 wrote:
Seems that I can just add a return statement in my evaluate() once I know that this message can be discard. Since my MQInput is not transactional, that message will be discarded by default.

Is that the right way, though?


Why wouldn't it be?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Apr 25, 2017 7:42 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

Are you using a MQGET node to read the queue?

How do you "move to the next message"?

If you are terminating the message transaction without reaching an output node for unwanted messages - that should work fine if transaction mode is NO.
_________________
Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 25, 2017 7:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

zpat wrote:
Are you using a MQGET node to read the queue?


We can, I think, assume this is not the case based on the OP's reference to an MQInput node.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
DevNYC1
PostPosted: Tue Apr 25, 2017 9:15 am    Post subject: Reply with quote

Apprentice

Joined: 22 Aug 2012
Posts: 32

Let me provide some additional details about this flow.

MQInput node ---> JNC ---> MQOutput

MQInput node's catch is connected to the Error Flow (logs/captures errors)

MQInput's Domain is set to XMLNCS

Inside JCN I do the usual XML XPath parsing:

Code:
MbElement body = root.getLastChild();
...
String  msgIdValue = body.getFirstElementByPath(expressionPath).getValueAsString();
.... check if this is the message we need
..... here various logic, calls to some existing Java APIs, database calls, etc.

out.propagate(outAssembly);
Back to top
View user's profile Send private message
DevNYC1
PostPosted: Tue Apr 25, 2017 9:18 am    Post subject: Re: Best way to discard messages in Java Compute Node post p Reply with quote

Apprentice

Joined: 22 Aug 2012
Posts: 32

Vitor wrote:
If you just want to parse XML with Java, you can do it in WAS for a fraction of the price.....
Perhaps. But I work in a large enterprise, and this flow includes calls to a bunch of Java libraries and APIs and is running in the message broker env maintained by another enterprise team. In a large company it takes time to build the non-PROD and prod environments, DR regions, replication, etc. I need to make a change to the existing flow that includes JCN, so this is what I need to deal with.

Will pay close attention to performance for sure. The cost of software is not something I need to worry about in this case.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 25, 2017 9:22 am    Post subject: Re: Best way to discard messages in Java Compute Node post p Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

DevNYC1 wrote:
Vitor wrote:
If you just want to parse XML with Java, you can do it in WAS for a fraction of the price.....
Perhaps. But I work in a large enterprise, and this flow includes calls to a bunch of Java libraries and APIs and is running in the message broker env maintained by another enterprise team. In a large company it takes time to build the non-PROD and prod environments, DR regions, replication, etc. I need to make a change to the existing flow that includes JCN, so this is what I need to deal with.

Will pay close attention to performance for sure. The cost of software is not something I need to worry about in this case.


I was more concerned that you were using BLOB in the MQInput node and parsing within the JCN. I'm less concerned about navigating the message tree with XPath.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 25, 2017 9:25 am    Post subject: Re: Best way to discard messages in Java Compute Node post p Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

DevNYC1 wrote:
I work in a large enterprise, and this flow includes calls to a bunch of Java libraries and APIs and is running in the message broker env maintained by another enterprise team.


So do I.

DevNYC1 wrote:
In a large company it takes time to build the non-PROD and prod environments, DR regions, replication, etc.


Not in these enlightened days, and I bet a large organization not only has a build procedure, it also has an existing WAS estate.

DevNYC1 wrote:
I need to make a change to the existing flow that includes JCN, so this is what I need to deal with.


Which is fair. I was (if only for the benefit of future readers) ensuring that using an XML parser on an input stream within a JCN was highlighted as a bad move.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Best way to discard messages in Java Compute Node post parse
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.