| Author | 
		  Message
		 | 
		
		  | psandip | 
		  
		    
			  
				 Posted: Mon Oct 19, 2009 1:07 am    Post subject: Using shared variables with additional instances | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 11 Aug 2006 Posts: 17
  
  | 
		  
		    
			  
				Hi,
 
 
I am using a shared variable for my message flow. The message flow generated a filename based on timestamp and assigns this name to the shared variable. A check is made within the compute node to see whether the shared variable is null or does it have a value. If it is null, the the filename is generated and assigned to it else, no need to assign a new name. Now suppose 10 instances of this message flow is to be deployed. once the shared variable is populated with a filename, can the other 9 flows access this value or they see it as null? _________________ With Best Regards,
 
Sandeep | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | WMBDEV1 | 
		  
		    
			  
				 Posted: Mon Oct 19, 2009 1:37 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Sentinel
 
 Joined: 05 Mar 2009 Posts: 888 Location: UK 
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | smdavies99 | 
		  
		    
			  
				 Posted: Mon Oct 19, 2009 1:42 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land. 
  | 
		  
		    
			  
				Did you try it for yourself? This is a good way to learn.
 
 
Also, don't double post. _________________ WMQ User since 1999
 
MQSI/WBI/WMB/'Thingy' User since 2002
 
Linux user since 1995
 
 
 
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | psandip | 
		  
		    
			  
				 Posted: Mon Oct 19, 2009 1:48 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 11 Aug 2006 Posts: 17
  
  | 
		  
		    
			  
				@WMBDEV1
 
 
Looked into the manul and checked that shared variables are shared across instances. Thanks.
 
 
@ smdavies99
 
 
I didn't double post on purpose. I got a timeout in my first attempt and then wnet back and resubmitteed. Then I saw the entire thing being doubly posted. I even tried to delete the earlier post but couldn't. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Mon Oct 19, 2009 2:53 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				You might also want to look up the word ATOMIC.
 
When working with a shared variable and multiple instances of the flow you have to consider thread safety...   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Sam Uppu | 
		  
		    
			  
				 Posted: Wed Oct 21, 2009 7:41 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Yatiri
 
 Joined: 11 Nov 2008 Posts: 610
  
  | 
		  
		    
			  
				To add it to the FJs point, you need to use BEGIN ATOMIC and END ATOMIC in your flow.
 
 
If I remember correctly, there should be a sample out there in the WMB examples in Toolkit 6.1/ 6.0
 
 
Thanks. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | MQEnthu | 
		  
		    
			  
				 Posted: Wed Oct 21, 2009 11:18 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Partisan
 
 Joined: 06 Oct 2008 Posts: 329 Location: India 
  | 
		  
		    
			  
				
   
	| psandip wrote: | 
   
  
	| Looked into the manul and checked that shared variables are shared across instances. | 
   
 
 
 
Also note that you cannot share variables across execution groups. _________________ ----------------------------------------------- 
 
It is good to remember the past,
 
but don't let past capture your future | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |