| Author | Message | 
		
		  | WBI_user | 
			  
				|  Posted: Wed Sep 17, 2003 1:55 pm    Post subject: Syncpoint control under JMS |   |  | 
		
		  | Partisan
 
 
 Joined: 07 Aug 2001Posts: 386
 
 
 | 
			  
				| How can I put or get a message within syncpoint using JMS. In native MQ I can spcify PMO or GMO to say syncpoint or no-syncpoint and this applies to each MQput or Get. That is within a single program, under an single connect and open, I can put multiple messages to the queue or get multiple messages from a queue with some message under syncpoint ans some not. I am new to JMS, how do I do this under JMS ?
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | EddieA | 
			  
				|  Posted: Wed Sep 17, 2003 2:15 pm    Post subject: |   |  | 
		
		  |  Jedi
 
 
 Joined: 28 Jun 2001Posts: 2453
 Location: Los Angeles
 
 | 
			  
				| It's part of the createQueueSession. 
 
 
   
	| Code: |  
	| QueueSession session; 
 boolean transacted = false;
 session = connection.createQueueSession(transacted,
 Session.AUTO_ACKNOWLEDGE);
 |  
 Conversly, set it to 'true' if you want syncpoint, in which case the acknowledgeMode is ignored.
 
 Be warned, that if you are running 'transacted', then you HAVE to issue a commit.  The default on closing a seesion is 'rollback'.
 
 Cheers,
 _________________
 Eddie Atherton
 IBM Certified Solution Developer - WebSphere Message Broker V6.1
 IBM Certified Solution Developer - WebSphere Message Broker V7.0
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | WBI_user | 
			  
				|  Posted: Wed Sep 17, 2003 2:39 pm    Post subject: |   |  | 
		
		  | Partisan
 
 
 Joined: 07 Aug 2001Posts: 386
 
 
 | 
			  
				| Thanks for the quick response. Please correct me if I am wrong. What If I want to do
 MQOPEN MYQ
 MQPUT MYQ (syncpoint)
 MQGET MYQ (syncpoint)
 MQPUT MYQ (syncpoint)
 MQPUT MYQ (no_syncpoint)
 MQGET MYQ (no_syncpoint)
 MQCLOSE MYQ
 
 Do I do a qseesion with transact =yes for calls that needs syncpoint or transact=no for those that do not ?
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | EddieA | 
			  
				|  Posted: Wed Sep 17, 2003 3:23 pm    Post subject: |   |  | 
		
		  |  Jedi
 
 
 Joined: 28 Jun 2001Posts: 2453
 Location: Los Angeles
 
 | 
			  
				| Well, the concept of an OPEN is hidden in other methods, but what you have suggested would work.  But you will be adding overhead by OPENing  the queue twice. 
 If there any reason why, if the 1st 3 PUTs are under a syncpoint, you want the last 2 outside.  Just curious, in case anyone can come up with a better solution.
 
 You could also achieve what you want with:
 
 
   
	| Code: |  
	| ..Code.. PUT
 ..Code..
 PUT
 ..Code..
 PUT
 COMMIT
 ..Code..
 PUT
 COMMIT
 ..Code..
 PUT
 COMMIT
 ..Code..
 |  But, are the COMMITs a bigger overhead than the additional OPEN. ?????
   
 Cheers,
 _________________
 Eddie Atherton
 IBM Certified Solution Developer - WebSphere Message Broker V6.1
 IBM Certified Solution Developer - WebSphere Message Broker V7.0
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | WBI_user | 
			  
				|  Posted: Wed Sep 17, 2003 8:12 pm    Post subject: |   |  | 
		
		  | Partisan
 
 
 Joined: 07 Aug 2001Posts: 386
 
 
 | 
			  
				| I just want to make sure I understand this clearly. Specifying transacted=true is like specifying syncpoint=yes under native MQ. Am I right ? If I specify transacted=false with CLIENT_ACKNOWLEDGE to get a message, the book says, "With this acknowledgement mode, the client acknowledges a message by calling a message’s acknowledge method." , does it mean that MQ will not delete the message until it is acknowledged by the application. Am I right  ? If so, what is the difference between using transacted=true and  CLIENT_ACKNOWLEDGE  with transacted=false ?
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kingdon | 
			  
				|  Posted: Thu Sep 18, 2003 3:55 am    Post subject: |   |  | 
		
		  | Acolyte
 
 
 Joined: 14 Jan 2002Posts: 63
 Location: UK
 
 | 
			  
				| The similarity you note between transacted sessions and client acknowledge is true for received messages. Client acknowledge doesn't impact sent messages though, so a client-ack session sends messages outside of syncpoint where as a transacted session sends messages under syncpoint. 
 Cheers,
 James.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | WBI_user | 
			  
				|  Posted: Sat Sep 20, 2003 4:54 pm    Post subject: |   |  | 
		
		  | Partisan
 
 
 Joined: 07 Aug 2001Posts: 386
 
 
 | 
			  
				| I did some testing and found that for JMS receive , transact=false with client_Ack behave the same as MQGET with syncpoint. I can see messages rolled back to the queue when I cancel my program before MQCMT or client_Ack is sent. Also JMS send with transact=true behaves the same as MQPUT with syncpoint . However JMS send with transact=false & client_Ack allow me to browse the message (i.e. message becomes available) before I issue the client_Ack. Is this normal ? Does client_Ack work for JMS send ?
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | WBI_user | 
			  
				|  Posted: Sat Sep 20, 2003 4:56 pm    Post subject: |   |  | 
		
		  | Partisan
 
 
 Joined: 07 Aug 2001Posts: 386
 
 
 | 
			  
				| Sorry, I think Kingdon has already answered my question. |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | WBI_user | 
			  
				|  Posted: Sun Sep 21, 2003 7:32 am    Post subject: |   |  | 
		
		  | Partisan
 
 
 Joined: 07 Aug 2001Posts: 386
 
 
 | 
			  
				| But then what's the difference between using Auto_Ack and Client_Ack in a JMS send message ? |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |