@Jason: thanks. I will have a look at our domain model to make sure equality 
is handled correctly.

@Matt; Thank for the suggestion. We will certainly consider your approach.

We are also considering a third approach (NOTE: this approach is only 
relevant if the race condition occurs on rare occasions):
Our Entity2 object has a "natural id" and we can place a unique constraint 
on the column in the database. 
When the MyMessage consumer tries to insert Entity2 and another consumer has 
already inserted it (due to a race condition) an exception will be thrown 
and the transaction fails. By setting the retry count in the service bus 
configuration > 1, the message will be processed again. The second time it 
will correctly find the inserted Entity2 in the database and reference that 
instead of trying to insert it.

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rhino-tools-dev/-/y2DL4v1WP5AJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en.

Reply via email to