| |
|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
| How to convert messages with a blank message format |
« View previous topic :: View next topic » |
| Author |
Message
|
| bruce2359 |
Posted: Thu Nov 30, 2006 10:48 am Post subject: |
|
|
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 |
Posted: Fri Dec 01, 2006 12:58 am Post subject: |
|
|
 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 |
|
 |
| fjb_saper |
Posted: Fri Dec 01, 2006 2:06 am Post subject: |
|
|
 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 |
|
 |
| zpat |
Posted: Fri Dec 01, 2006 3:19 am Post subject: |
|
|
 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 |
|
 |
| bruce2359 |
Posted: Fri Dec 01, 2006 8:07 am Post subject: |
|
|
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 |
Posted: Sat Dec 02, 2006 10:37 am Post subject: |
|
|
 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 |
|
 |
|
|
|
|
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
|
|
|
|