Author |
Message
|
geethgubi |
Posted: Tue Feb 17, 2009 1:35 pm Post subject: Question on uncommitted insert using message flow |
|
|
Apprentice
Joined: 18 Dec 2008 Posts: 44
|
I have a scenario in the message broker where I am getting the xml message in one of my flows and I will take the data from that xml and insert it into the database. There are chances that I can get multiple messages at a time. Currently I am getting 2 messages (This is actually bug) one of them is a original message generated and the other one is a duplicate message. So if you see the data, the data remains the same for both the messages. And hence while inserting the data into the database I am getting an error which says root sql exception. some of my collegues are telling tha t this is due to the uncommit lock issue. So can somebody help me out with what will happen when I send the same data twice and keep my Transaction property of compute node as 'Automatic'?
Thanks. |
|
Back to top |
|
 |
MQEnthu |
Posted: Tue Feb 17, 2009 10:16 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
If you set transaction property of the compute node to Automatic, the database transactions will depend on the success or failure of the entire message flow.
If you are trying to insert duplicate data into database, there will be sql error. And by default the flow throws exception for databse errors (unless you have cleared the check box 'throw exception on database errors'). You will have to handle the exception in the messageflow. _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
vandi |
Posted: Wed Feb 18, 2009 7:09 am Post subject: |
|
|
Acolyte
Joined: 13 Dec 2008 Posts: 67
|
Hi,
As you told you are getting two messages, try to keep flag on the original message, so that it would prevent duplicate insertions.
Thanks
vandi |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Feb 18, 2009 7:40 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
vandi wrote: |
Hi,
As you told you are getting two messages, try to keep flag on the original message, so that it would prevent duplicate insertions.
Thanks
vandi |
No, this is bad. This is message affinity. Do not design this. |
|
Back to top |
|
 |
vandi |
Posted: Wed Feb 18, 2009 7:48 am Post subject: |
|
|
Acolyte
Joined: 13 Dec 2008 Posts: 67
|
mqjeff,
I am focussiong on a way to distinguish the original message with the message being inserted to DB.
Thanks
Vandi |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Feb 18, 2009 7:51 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
MQEnthu answered that. The database will throw an error when you try to insert duplicate data or data into a row with a duplicate key.
That's how you tell.
Anything else is the wrong approach. |
|
Back to top |
|
 |
vandi |
Posted: Wed Feb 18, 2009 7:58 am Post subject: |
|
|
Acolyte
Joined: 13 Dec 2008 Posts: 67
|
mqjeff,
Thanks for your suggestion. Will make sure to answer to the point.
Thanks
vandi |
|
Back to top |
|
 |
|