I have the following situation on my system:
I have a few modules
3. NotificationModule (sending a notification to a user telling him that he received an email)
MailAndUsersModule is a j2ee app (inside jboss) GUIModule is a c++ one and NotificationModule is a c++ one the way GUIModule and NotificationModule talks to MailAndUsersModule is by calling its servlets
The scenario is this
1. A user using the GUIModule sends an email to a user that does not exist in the system
2. MailAndUsersModule receives that mail, creates that new user in the system, and tries to send a notification to him telling him that a new mail arrived
3. MailAndUsersModule while creating the user (after) calls (its in the same transaction) NotificationModule and tells it to send a notification
4. NotificationModule received the message from MailAndUsersModule to send a new notification to user X and its trying to authenticate to make sure user X exists inside MailAndUsersModule .
However at that point the transaction of MailAndUsersModule did not end so MailAndUsersModule returns a result saying that the user X does not exist yet however I need the NotificaitonModule to send a notification to the user X
so i'm in kind of a wierd situation... my module created the user and asked a differnt module to send a notificaiton that notificationModule wanted first to make sure with me that my user exist however my transaction didnt end so i couldnt tell it that the user do exist...
What can i do about it? anyone can help?
You need to break up the transaction as its isolation semantics are not valid for the usecase you state.