Author |
Message
|
Jumani |
Posted: Thu Aug 25, 2022 4:32 am Post subject: IIB unique ID generation |
|
|
Newbie
Joined: 25 Jul 2022 Posts: 7
|
Hi,
I have a requirement where need to generate unique ID which will not greater than 24 characters or 48 bytes, I have tested with UUIDASCHAR but the length is greater one. ID generated from MQOUTPUT node is exact 48 bytes but trying to understand will MQOUTPUT node always generate unique ID even among two requests one is in pending state. Thanks |
|
Back to top |
|
 |
gbaddeley |
Posted: Thu Aug 25, 2022 5:13 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
If you are referring to a MQ MessageId that is generated and returned by MQ after a message is put to a queue, MQ will guarantee that this is unique. This can be used to correlate request and reply messages, without going to the pain of generating your own unique ids. _________________ Glenn |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Aug 25, 2022 5:57 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Is it for MsgId and CorrelId? Or something else? Do you just need pseudo-random numbers/letters?
Please provide a more precise definition of your need. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Jumani |
Posted: Thu Aug 25, 2022 9:07 pm Post subject: |
|
|
Newbie
Joined: 25 Jul 2022 Posts: 7
|
Hi,
MF1(treat as server)
Timeout notification node -> esql(build http request) -> HTTP request node -> esql(dynamic route to queue, say Q1 for initial packet(ISOReq), and Q2 for final packet(ISORes) ) -> MQ output node
MF2(teat as client)
MQ input node -> esql(fund transfer request) -> HTTP request node -> esql(initial status response) -> MQGET -> ...
MF1 open thread every 1 second, check for data available at third party server or not, if data(consist of unique id from server which is greater than 24) is available it will pass to MF2 using MQ output node.
MF2 Process the request and send initial status to same third party server using HTTP request node and wait for getting final res from MF1 against same unique id which is greater than 24.
Problem is i can not pass unique id which is greater than 24 to MQGET node, i need to generate internal unique id against the packet unique id(greater than 24) which will be used for MQGET to get final data.
Thanks |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Aug 26, 2022 5:46 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
I’m still a bit confused.
Is 24 in your description a numeric value of some application data ID field, or the SIZE of your ID field?
MQMD fields MessageID, CorrelId and GroupeId, are each 24bytes wide. A subsequent MQGET call with match options is limited to 24bytes.
Where is your ID field? Is it part of your application data? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Aug 26, 2022 6:27 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
This post is a duplicate of your prior post regarding MsgId and CorrelId fields support by IBM MQ. http://www.mqseries.net/phpBB2/viewtopic.php?t=78305
Were you hoping for a different answer? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
gbaddeley |
Posted: Sun Aug 28, 2022 3:28 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
Jumani wrote: |
Hi,
Problem is i can not pass unique id which is greater than 24 to MQGET node, i need to generate internal unique id against the packet unique id(greater than 24) which will be used for MQGET to get final data.
Thanks |
What is the format of the unique packet unique id? ie. You could pull out the medium-term unique parts. You could encode character digits from 8 down to 4 bits. You could encode common strings as single characters, etc. _________________ Glenn |
|
Back to top |
|
 |
Jumani |
Posted: Mon Aug 29, 2022 9:22 am Post subject: |
|
|
Newbie
Joined: 25 Jul 2022 Posts: 7
|
Quote: |
Where is your ID field? Is it part of your application data?
|
Yes its a ISO field/element among whole application data having length of 24 character.
Quote: |
You could encode common strings as single characters, etc
|
Will this single character acceptable to MQGET as correlation id ? can you please share sample for encoding
Quote: |
Were you hoping for a different answer?
|
Yes.
Please help, Thanks |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Aug 29, 2022 12:09 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Jumani wrote: |
Will this single character acceptable to MQGET as correlation id ? can you please share sample for encoding
|
MQGET with MatchOptions for CorrelId will match on any 24BYTE field of any type data. It could be 24BYTES of a jpg, an audio file, or note from your doctor.
Sample for encoding what, exactly?
I strongly suggest you read the IBM MQ Development documentation to more fully understand MsgId, CorrelId, GroupId fields, MQ BYTE data type, and MQGET match options. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Jumani |
Posted: Tue Aug 30, 2022 8:02 am Post subject: |
|
|
Newbie
Joined: 25 Jul 2022 Posts: 7
|
Quote: |
Yes its a ISO field/element among whole application data having length of 24 character.
|
It was my typo error, application data unique field has length greater than 24, which is not acceptable to MQGET.
Quote: |
Sample for encoding what, exactly?
|
can we compress or encode application data unique id which is greater than 24 so that it will be passed as MQGET correlation id.
Till now i have generated another unique id from esql whose length is 24(current date time upto nano seconds) and cached it as value against application data unique id and pass to MQGET as correlation id. this fails when huge amount of txns arrived and internal generated unique id is being duplicated.
Please suggest:
can we compress character value having length greater than 24 in a way so that it can be passed to MQGET as correlation ?
or any esql mechanism which always generate unique id upto 24 character length?
or i need to get unique id from MQOutput node, will this correlation id always be unique or it can be duplicated.
Thanks alot |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Aug 30, 2022 10:27 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Jumani wrote: |
Till now i have generated another unique id ... |
If there are duplicates, then you have NOT created a unique id.
How do you know that there are duplicates? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Aug 30, 2022 12:43 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
MQGET match options match on the 24BYTE MsgId, CorrelId, GroupId.
Is there an absolute requirement that the supplied "unique id" MUST somehow be manipulated or transformed down to a unique 24BYTE CorrelId? Or, is that how you envision the solution?
How about this out-of-the-box idea:
View the 24BYTES as a unique binary number from 0 through 2**192.
A single 8bit byte offers 256 unique numbers, 2 8bit bytes offer 65,536 unique numbers. Is 64k unique CorrelIds adequate for our needs? Start at a value of 1.
Create a 2d table.
In column 1, insert the 24-48 byte/character "unique id" provided to you.
In column 2, "assign" the 2BYTE binary value. Call it the Effective CorrelId or some such. Increment by 1 for each new "unique id". Use this as the MsgId, CorrelId.
Or have I completely misunderstood your requirement ... again? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Aug 30, 2022 7:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You are going down the complete wrong architecture path.
DO NOT GENERATE a messageId for MQ. LET MQ GENERATE IT. It will be unique for MQ. Use that generated messageId to match the correlationID when looking at the response from MQ.
Why do you need it to match the one generate for a complete different purpose? You could create a correspondance table (transactionID -- MQ MessageID(s) )
Hope it helps.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
gbaddeley |
Posted: Wed Aug 31, 2022 5:24 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
Jumani wrote: |
Till now i have generated another unique id from esql whose length is 24(current date time upto nano seconds) and cached it as value against application data unique id and pass to MQGET as correlation id. this fails when huge amount of txns arrived and internal generated unique id is being duplicated. |
You are falling foul of the exact reason why you should not be doing this. Let MQ generate a unique ID. _________________ Glenn |
|
Back to top |
|
 |
Jumani |
Posted: Wed Aug 31, 2022 9:05 pm Post subject: IIB unique ID generation |
|
|
Newbie
Joined: 25 Jul 2022 Posts: 7
|
Hi,
Quote: |
DO NOT GENERATE a messageId for MQ. LET MQ GENERATE IT. It will be unique for MQ. Use that generated messageId to match the correlationID when looking at the response from MQ.
|
I have updated code with this and it works fine with heavy load. Thanks alot
Quote: |
Create a 2d table.
In column 1, insert the 24-48 byte/character "unique id" provided to you.
In column 2, "assign" the 2BYTE binary value. Call it the Effective CorrelId or some such. Increment by 1 for each new "unique id". Use this as the MsgId, CorrelId.
|
Thanks a lot with this brilliant approach, I know this will also work.
Quote: |
If there are duplicates, then you have NOT created a unique id.
|
You are absolutely right, this was the reason I was trying to ask any unique id generation mechanism so that i can map provide to MQGET.
Quote: |
You are falling foul of the exact reason why you should not be doing this. Let MQ generate a unique ID.
|
You are absolutely right, now doing this it works fine till now.
Thanks you all for such a great support at such a great platform  |
|
Back to top |
|
 |
|