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 » General IBM MQ Support » How to convert messages with a blank message format

Post new topic  Reply to topic Goto page Previous  1, 2, 3, 4
 How to convert messages with a blank message format « View previous topic :: View next topic » 
Author Message
bruce2359
PostPosted: Thu Nov 30, 2006 10:48 am    Post subject: Reply with quote

Guest




Allow me to repeat myself:

an initial value is not a default. A programmer may live with an initial value.. This is not a best practice. The programmer should set each and every field in the MQMD (and the application data) with a value that meets the business requirement. This is a best practice.

Perhaps in your case, the initial value meets your business case; but AS_Q_DEF for PERSISTENCE or PRIORITY means that the program will behave differently depending on the setting of a queue attribute - something outside the control of the application. Again, this is not a best practice.

If you demand best practices, you will get them. Anything less, is less.
Back to top
zpat
PostPosted: Fri Dec 01, 2006 12:58 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5867
Location: UK

I was just pointing out what values were used if the programmer does not explicitly code them. I was not stating best practice.

In my experience many programmers only set the MQMD values that they have to do to get their programs working in their test environment. Hence the defaults are very important.

I can't see the point arguing about this. I am stating verifiable facts about the MQI, nothing more, nothing less.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 01, 2006 2:06 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20773
Location: LI,NY

zspat wrote:
In my experience many programmers only set the MQMD values that they have to do to get their programs working in their test environment.

So blame it on lax testing. A good test would include negative testing conditions and those should flush out the problems, especially if you did not code the "defaults" properly...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
zpat
PostPosted: Fri Dec 01, 2006 3:19 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5867
Location: UK

Some vendors don't have mainframes (for example) to test with. I can't control all the external factors.

I am getting fed up of this debate so I am going to stop posting.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Fri Dec 01, 2006 8:07 am    Post subject: Reply with quote

Guest




I hadn't intended to offend. I appologize. Conversation and debate benefit us all.

Reading through posts here, and working with clients (the human kind), it becomes clear that nearly all 'problems with MQ' end up being misunderstandings about the MQ product, its capabilities and usage.

I undestand your frustration with vendors, programmers, limited or no testing, and bad application code.

We all work in less-than-desirable working conditions. What I'm trying to suggest is that we all conspire to raise the bar.

I mentioned earlier that programmers are trainable. If we don't demand more from them, or at least raise these issues with management, then we are doomed to the path of mediocrity. Some organizations (perhaps yours) don't want to hear bad news.

It is better that they hear bad news early, before the problem escalates. At least I sleep well knowing that I said something - even if it was ignored.

Again, I appologize if I offended.
Back to top
RogerLacroix
PostPosted: Sat Dec 02, 2006 10:37 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3266
Location: London, ON Canada

Hi,

You can always use the "Convert" option on MQGet calls and, as you have seen, MQ will throw an exception when it encounters a problem. But some problems aren't really problems but warning.

I know of 3 exceptions that are warnings rather than errors and your application can continue to process the returned message:
- MQRC_FORMAT_ERROR
- MQRC_TRUNCATED_MSG_ACCEPTED
- MQRC_DBCS_ERROR

These exceptions can be thrown on Convert on Get but your application does indeed get the meessage from the queue.

Your code should look something like:
Code:
MQGetMessageOptions getOptions = new MQGetMessageOptions();
getOptions.options = MQC.MQGMO_NO_WAIT + MQC.MQGMO_CONVERT + MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_ACCEPT_TRUNCATED_MSG;

MQMessage getMsg = new MQMessage();
try
{
   _inQ.get(getMsg, getOptions);

   extractMsgText(getMsg);
}
catch (IOException e)
{
   System.out.println("IOException during GET: " + e.getMessage());
}
catch (MQException e)
{
   if ( (e.completionCode == 1 && e.reasonCode == MQException.MQRC_FORMAT_ERROR)           ||
        (e.completionCode == 1 && e.reasonCode == MQException.MQRC_TRUNCATED_MSG_ACCEPTED) ||
        (e.completionCode == 1 && e.reasonCode == MQException.MQRC_DBCS_ERROR)             )
   {
      extractMsgText(getMsg);
   }
   else if (e.completionCode == 2 && e.reasonCode == MQException.MQRC_NO_MSG_AVAILABLE)
   {
      // System.out.println("All messages read.");
   }
   else
   {
      System.out.println("GET Exception: " + e);
   }
}


Hope that helps.

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2, 3, 4 Page 4 of 4

MQSeries.net Forum Index » General IBM MQ Support » How to convert messages with a blank message format
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.