| Author | 
		  Message
		 | 
		
		  | ram_s | 
		  
		    
			  
				 Posted: Thu Mar 26, 2009 4:49 am    Post subject: Global transaction with DB2 and MQ | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 26 Mar 2009 Posts: 3
  
  | 
		  
		    
			  
				We have an MDB which picks message from a queueA , calls a stored procedure to do business logic and finally sends a response message to queueB .
 
 
Since database as well as Queue are involved, the MDB runs with a transaction type set to "Required" in a container managed transaction.
 
 
Given this, there is a specific condition which we are not able to achieve. In case of any business error returned by stored proc (Ex: Customer is invalid) then we have to intimate this error by sending a error message to the response queue. At the same time any database operations (inserts/updates) performed have to be rolledback.
 
 
The requirement is : In case of business errors, MDB has to write to a queue but within global transaction
 
 
We tried 2 options:
 
1. In case of business error, if we do a setRollbackOnly() the database and the request messages also gets rolledback.
 
 
2. We tired using SAVEPOINTS in the stored proc and do a Rollback to Savepoint in case of business errors. In this case it gives an exception that, Savepoint cannot be used in a Global transaction.
 
 
Can anyone help as to how to do this. I am using WAS6.0 and DB2 as database. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | WMBDEV1 | 
		  
		    
			  
				 Posted: Thu Mar 26, 2009 5:06 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Sentinel
 
 Joined: 05 Mar 2009 Posts: 888 Location: UK 
  | 
		  
		    
			  
				| Are you using CMP or BMP? I think to achieve this, you have to use BMP. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | ram_s | 
		  
		    
			  
				 Posted: Thu Mar 26, 2009 5:19 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 26 Mar 2009 Posts: 3
  
  | 
		  
		    
			  
				| Entity beans are not used. Instead, the MDB calls a stored procedure in DB2 using JDBC. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | WMBDEV1 | 
		  
		    
			  
				 Posted: Thu Mar 26, 2009 5:46 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Sentinel
 
 Joined: 05 Mar 2009 Posts: 888 Location: UK 
  | 
		  
		    
			  
				| You can still use BMP within MDBs. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | ram_s | 
		  
		    
			  
				 Posted: Thu Mar 26, 2009 6:02 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 26 Mar 2009 Posts: 3
  
  | 
		  
		    
			  
				The customer we are working isnt open to using BMPs since the existing methodology used is stored procedure thru jdbc. 
 
 
Can we achive using this? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | WMBDEV1 | 
		  
		    
			  
				 Posted: Thu Mar 26, 2009 6:53 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Sentinel
 
 Joined: 05 Mar 2009 Posts: 888 Location: UK 
  | 
		  
		    
			  
				| You can achieve it by getting the DB to rollback (or perform a compensating transaction) its work within the stored procedure and then indicating to the MDB that its failed. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Thu Mar 26, 2009 3:11 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				It is very unclear to me what you are trying to achieve.
 
 
In case of a problem do you want to 
 
- roll back DB2 but commit the MQ part with sending a message?
 
Not a real multiphase commit here...
 
 - roll back DB2, roll back MQ and send a message (how many times will you send that message ? see bothresh
 
  
 
In my opinion this needs to be controlled with a number of different method and the transactionality on these methods needs to be set correctly...
 
Required vs Requires New etc...
 
 
Have fun   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |