Author |
Message
|
Bharat |
Posted: Fri Jan 24, 2003 10:02 am Post subject: How to check for duplicate XML files? |
|
|
 Acolyte
Joined: 14 May 2002 Posts: 61 Location: Reston, VA, USA
|
I'm using MQSI v2.0.1 for transforming and routing XML contracts. I'm getting an input XML file from one application. My requirement is: Sometimes that application may send duplicate XML contracts, when it encountered some database issues. I need to track that and ignore the duplicate XML files. The input XML file contains a tag called 'TransactionID'. I need to check for this tranactionID gets repeated to figure out duplicate XML files.
But right now I'm not tracking the transaction ID tag. As a MessageID is allotted to each message, MQSI is going by Message ID. I mean I'm storing this messageID in the DB2 database, but not the transactionID.
Which is the best way to track and discard the duplicate XML files in this case?
Thanks in advance,
Bharat |
|
Back to top |
|
 |
kirani |
Posted: Fri Jan 24, 2003 10:44 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Introduce a new field in the database to store TransactionId. In your message flow, first check for the Transaction ID, if it's duplicate continue with the processing for next tran id. For non-duplicate transaction ID do the transformation and insert a record into db for this transaction id. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Bharat |
Posted: Fri Jan 24, 2003 11:25 am Post subject: How to check for duplicate XML files? |
|
|
 Acolyte
Joined: 14 May 2002 Posts: 61 Location: Reston, VA, USA
|
Kiran,
First let me thank you for your response.
Can I get the value stored in database in a Filter Node? For example there might be 100 rows of transaction IDs stored in that table? Do I need to check the transaction ID coming from the file with all these values?
Could you please send me the sample syntax of ESQL?
Thanks,
Bharat |
|
Back to top |
|
 |
yaakovd |
Posted: Fri Jan 24, 2003 11:51 am Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
I manage transaction IDs in DB2 for the similar problem. This table contains 200 000 records (is it enougth?).
The first node in flow is Filter, when I looking for ID:
EXISTS( SELECT * FROM Database.TRANS_TB AS T WHERE
T.TRANS_ID = "Root".<your input ID>)
or you ca use SELECT COUNT ... > 0
Also you can manage counter of duplications, date etc. if you need.
Good luck  _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
Bharat |
Posted: Fri Jan 24, 2003 12:16 pm Post subject: How to check for duplicate XML files? |
|
|
 Acolyte
Joined: 14 May 2002 Posts: 61 Location: Reston, VA, USA
|
Yaakovd,
Thanks for your response.
EXISTS( SELECT * FROM Database.TRANS_TB AS T WHERE
T.TRANS_ID = "Root".<your input ID>)
Is it enough to check all the rows against the transaction ID existing in the XML file? I was thinking that we may need to write a SQL query with 'for loop'.
Before doing this comparision, I'm trying to store the Transaction ID in the database with the following syntax. But it is not getting stored.
INSERT INTO Database.Table(MESSAGEID, TRANSID) VALUES ( CAST(Root.MQMD.MsgId AS CHARACTER), Trim(Root.XML.request.control.transactionId) );
'transactionId' is in the control block of the XML file.
Could you please guide me with right syntax?
Thank you so much,
Bharat |
|
Back to top |
|
 |
yaakovd |
Posted: Fri Jan 24, 2003 12:30 pm Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
If you have more then 1 transaction ID in message - you need loop.
I suggest create subflow, which process eacn transaction by following logic:
1. Filter {EXISTS( SELECT * FROM Database.TRANS_TB AS T WHERE
T.TRANS_ID = "Root".<your input ID>) }
True: --> 2. Ignore the message or update counter of duplications ...
False: --> 3. Data Insert Node which insert your transaction ID into the table
3 --> 3A - process the message _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
Bharat |
Posted: Fri Jan 24, 2003 12:43 pm Post subject: How to check for duplicate XML files? |
|
|
 Acolyte
Joined: 14 May 2002 Posts: 61 Location: Reston, VA, USA
|
Thank you so much Yaakovd.
I will try this and let you know if there are any problems.
Best Regards,
Bharat |
|
Back to top |
|
 |
yaakovd |
Posted: Fri Jan 24, 2003 12:49 pm Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
Don't forget to add database connection in Filter and Data Insert nodes. _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
|