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 » IBM MQ Java / JMS » Discussion: get method and exception throwing

Post new topic  Reply to topic
 Discussion: get method and exception throwing « View previous topic :: View next topic » 
Author Message
kolban
PostPosted: Wed Aug 29, 2001 8:01 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

Preamble


In the IBM MQQueue class there is a method called get() which retrieves a message from a queue. This method has a number of overloaded versions including one which allows an MQGetMessageOptions object to be supplied as well as a maximum message length. By using this combination, a portion of the message may be retrieved (destructively or with a browse operation).

If the message actually on the queue is bigger than the maximum length allowed, an MQException is thrown. This exception specifies that a trunctated message was accepted.


Discussion


In Java, the cost of throwing an exception is expensive. If one wishes to browse a queue and examine, say, the first 10 bytes of each message, an exception will have to be handled for each message. This feels like a poor performer.

The returned message already contains how many bytes are in the message retrieved and how many bytes are in the original message. I think I would like to have seen NO exception thrown and leave it to the consumer of the message to determine if the complete or partial message was returned.





[ This Message was edited by: kolban on 2001-08-29 21:01 ]
Back to top
View user's profile Send private message
bduncan
PostPosted: Wed Aug 29, 2001 10:07 pm    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

Neil,
I definitely agree with you. I like the way the Perl API handles this situation. It simply returns a CompCode of "warning" and Reason "truncated message accepted" if you have specified MQGMO_ACCEPT_TRUNCATED_MESSAGES in your get options. This is nice because I can check for such a reason being returned if need be, otherwise I can just ignore it, like in the case you point out when I'm simply browsing the first few bytes of the message.
I don't see why the Java API can behave similarly, where we get notified of the truncation not through an exception, but via the CompCode and Reason only.
my 2cents...


_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
brem
PostPosted: Tue Mar 11, 2008 10:18 am    Post subject: Reply with quote

Newbie

Joined: 11 Mar 2008
Posts: 3

Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 11, 2008 10:22 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981



?
_________________
I am *not* the model of the modern major general.
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 » IBM MQ Java / JMS » Discussion: get method and exception throwing
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.