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 DataPowerHow to set MQMD.MsgId in ESQL

Post new topicReply to topic
How to set MQMD.MsgId in ESQL View previous topic :: View next topic
Author Message
CuriCAT
PostPosted: Thu Apr 05, 2007 5:42 am Post subject: How to set MQMD.MsgId in ESQL Reply with quote

Voyager

Joined: 26 Sep 2006
Posts: 82

Can you please tell me how to set MsgId in ESQL.

I have been trying for past 3 hours. nothing is working..

SET OutputRoot.MQMD.MsgId= CAST('ABC' AS BLOB CCSID InputRoot.Properties.CodedCharSetId);

SET OutputRoot.MQMD.MsgId = CAST('ABC'AS AS BLOB);

SET OutputRoot.MQMD.MsgId = 'ABC';


Thanks in advance.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
jefflowrey
PostPosted: Thu Apr 05, 2007 5:53 am Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Set OutputRoot.MQMD.MsgId = MQMI_NONE;
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
CuriCAT
PostPosted: Thu Apr 05, 2007 5:59 am Post subject: Reply with quote

Voyager

Joined: 26 Sep 2006
Posts: 82

Thanks Jeff,

But I wanted to set 'ABC' in the msg id at Message Broker and send the message.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Vitor
PostPosted: Thu Apr 05, 2007 6:15 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25365
Location: Ohio, USA

CuriCAT wrote:
But I wanted to set 'ABC' in the msg id at Message Broker and send the message.


There are very, very good reasons why that is a very, very bad idea. If you search the forum you'll find a number of discussions on the subject.

At best you're reinventing a wheel IBM have spent many years getting perfectly circular and have provided as part of your license fee. At worst you'll bring your system crashing down with a duplicate message id.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
madi
PostPosted: Thu Apr 05, 2007 12:55 pm Post subject: Reply with quote

Chevalier

Joined: 17 Jan 2006
Posts: 475

but if u do want to set 'ABC' to the msg id

this is why ur code is not working : msgid is 24 bytes length and will not take anything other than that

so heres how ur code should be
Code:


DECLARE v_msgId CHAR 'ABC';
SET v_msgId = v_msgId || REPLICATE('0',(24-LENGTH(v_msgId)))
SET OutputRoot.MQMD.MsgId= CAST(v_msgId AS BLOB CCSID InputRoot.Properties.CodedCharSetId);


If you HAVE to set the msgid then try to set it to some format of timestamp like yyyyMMddDDDHHmmssSSSSSS0 which will atleast avoid duplication to a good extent

good luck
madi
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Apr 05, 2007 1:02 pm Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

madi wrote:
but if u do want to set 'ABC' to the msg id

Then by and large you have done something wrong.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Apr 06, 2007 2:57 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25365
Location: Ohio, USA

madi wrote:

If you HAVE to set the msgid then try to set it to some format of timestamp like yyyyMMddDDDHHmmssSSSSSS0 which will atleast avoid duplication to a good extent


A good extent, but not a total extent and you've attempted to recreate the IBM mechanism.

Also if CuriCAT wanted to use an abstract timestamp the question would not have been asked. The post stems from the classic "let's use our serial number / order id / customer number"as the id in all our messages" design decision. Not least because the id is (as you point out) a byte array not a string.

Nor a date time stamp as you suggested using it.
_________________
Honesty is the best policy.
Insanity is the best defence.


Last edited by Vitor on Mon Apr 09, 2007 8:31 am; edited 1 time in total
Back to top
View user's profile Send private message
tleichen
PostPosted: Fri Apr 06, 2007 7:27 am Post subject: Reply with quote

Yatiri

Joined: 11 Apr 2005
Posts: 663
Location: Center of the USA

You should read about how the API works. Usually, there is no good reason to set this.
_________________
IBM Certified MQSeries Specialist
IBM Certified MQSeries Developer
Back to top
View user's profile Send private message
supreeth
PostPosted: Mon Aug 20, 2007 11:45 am Post subject: Reply with quote

Voyager

Joined: 17 May 2005
Posts: 90
Location: London

Guys ... sorry to reopen this post. I had a requirement where I needed to set the MsgId. I was browsing through the forum and found this post which had some interesting conversation.

I disagree to the fact that we would never have to set the msgId. May be true while putting a message. But howabt getting a message based on the msgId ... for this, we have to set the MsgId field of MQMD. Lemme explain u the business scenario. We have an archive logic where we archive messages based on client wanting us to archive. The clients sometimes asks to replay the message and the only key/handle they wud have is the MsgId ... So, we need to set the MsgId in the MQMD before doing a get. In order to indicate the dupchk logic that this is an archived/replayed message ... we set the replay flag to 1. This would bypass our dupchk logic ...

Well, this scenario I can recollect from memory. The requirement I have now is completely different and I need to achieve this ( Setting MsgId in MQMD ) in Datapower. Any help here ....

cheerz!!!
supreeth
_________________
Supreeth Gururaj
IBM Certified WMQ Solution Expert
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Aug 20, 2007 3:55 pm Post subject: Reply with quote

Grand Poobah

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

supreeth wrote:
But howabt getting a message based on the msgId ... for this, we have to set the MsgId field of MQMD. Lemme explain u the business scenario. We have an archive logic where we archive messages based on client wanting us to archive. The clients sometimes asks to replay the message and the only key/handle they wud have is the MsgId ...

Ok, so what? You get passed a byte array and look for the same in a DB...

supreeth wrote:
So, we need to set the MsgId in the MQMD before doing a get. In order to indicate the dupchk logic that this is an archived/replayed message ... we set the replay flag to 1. This would bypass our dupchk logic ...

Bad design. And BTW queues should not be treated as DB tables...

At best I would pass the messageId to the correlationId and let the system set the messageId. Anyway it is not possible in JMS where each message's messageId is set by the system...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
supreeth
PostPosted: Tue Aug 21, 2007 5:47 am Post subject: Reply with quote

Voyager

Joined: 17 May 2005
Posts: 90
Location: London

Quote:
And BTW queues should not be treated as DB tables...


True ... We had it stored in the queue for the specified SLA ( I think 1 day ) before being saved onto a file. We had a utility written which would save the message older than a specified time from a queue onto a file. I don't exactly remember the design but I think it was something like this.

Neways ... I am now designing a logic to handle duplicate messages going onto backend systems from Datapower. Transactionality is poor/non-existant in DP and we somehow need a mechanism where we could skip sending duplicate messages of a partially completed previous transaction. For a single transaction, I create multiple messages ( subset of the original msg ) and send it to multiple backends ( dynamically route it ) While doing this ... because of many reasons, the transaction might fail say, only after a couple of puts leaving them at the risk of getting duplicates when the transaction is restarted.

I initially thought of auditing the msgId of the message which came in with information on how many message writes were successful and later fetch this information for a restarted transaction. Its however a not so good approach as I found out and also its not something easy to handle byte arrays in XSLT, if at all its possible. Also, as I mentioned ... co-ordinated sync point is absent from DP at this point in time and i cannot be sure of even my audit information. So, I am looking at a couple of other options.

Any inputs here is appreciated.

cheerz!!!
supreeth
_________________
Supreeth Gururaj
IBM Certified WMQ Solution Expert
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Aug 21, 2007 1:15 pm Post subject: Reply with quote

Grand Poobah

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

Looks like you should be putting in for the Process Server and compensating transactions...

Anyways, forget about the difficulty of byte arrays in XML/XMLNS/XMLNSC...
You can just as well use the hex representation of the byte array (24 bytes => 42 char value from 0->F)

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
supreeth
PostPosted: Tue Aug 21, 2007 1:37 pm Post subject: Reply with quote

Voyager

Joined: 17 May 2005
Posts: 90
Location: London

i don think thats possible either using XSLT. This language is creepier to use man ... I am so used to the structured and OO programming languages ... uff ... having a hard time ... neways ... thnx for ur responses ...

cheerz!!!
supreeth
_________________
Supreeth Gururaj
IBM Certified WMQ Solution Expert
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Aug 21, 2007 1:47 pm Post subject: Reply with quote

Grand Poobah

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

I thought you'd create your own java functions for this and just call them from XSLT...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
supreeth
PostPosted: Tue Aug 21, 2007 6:59 pm Post subject: Reply with quote

Voyager

Joined: 17 May 2005
Posts: 90
Location: London

No, unfortunatley DP is a totally different animal. Its interesting nonetheless. if u r curious ... heres the link for downloading the manuals. Ensure u hav a registered IBM id to login.

Its for sure gonna give MB and other BI tools a run for their money once it matures and stabilizes ... interesting to see how IBM would market it without killin broker and its ESB. IBM is aggressively marketing DP and its taking DP a long distance. DP now directly integrates with TX from firmware version 3.6.0.17 ... well, I'm sorry ... the discussion went completely tangential to the topic of the message. Request u guys to move it elsewhere if u think its appropriate.

https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_US&source=swg-datapower&S_PKG=Entry

cheerz!!!
supreeth
_________________
Supreeth Gururaj
IBM Certified WMQ Solution Expert
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 DataPowerHow to set MQMD.MsgId in ESQL
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.