You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2005/10/04 09:38:33 UTC

svn commit: r293560 - in /webservices/sandesha/trunk/src/org/apache/sandesha2: Constants.java InOrderInvoker.java msgprocessors/ApplicationMsgProcessor.java

Author: chamikara
Date: Tue Oct  4 00:37:52 2005
New Revision: 293560

URL: http://svn.apache.org/viewcvs?rev=293560&view=rev
Log:
Completed the delivery assurance part.
Users can select 
IN_ORDER/NOT_IN_ORDER && EXACTLY_ONCE/MORE_THAN_ONCE

Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/InOrderInvoker.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java?rev=293560&r1=293559&r2=293560&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Tue Oct  4 00:37:52 2005
@@ -181,7 +181,7 @@
 
 			String NOT_IN_ORDER = "NotInOrder";
 
-			String DEFAULT_DELIVERY_ASSURANCE = NOT_IN_ORDER;
+			String DEFAULT_DELIVERY_ASSURANCE = IN_ORDER;
 		}
 		
 		public interface InvocationType {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/InOrderInvoker.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/InOrderInvoker.java?rev=293560&r1=293559&r2=293560&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/InOrderInvoker.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/InOrderInvoker.java Tue Oct  4 00:37:52 2005
@@ -78,7 +78,7 @@
 			try {
 				Thread.sleep(1000);
 			} catch (InterruptedException ex) {
-				ex.printStackTrace();
+				System.out.println("Invoker was Inturrepted....");
 			}
 			
 
@@ -137,11 +137,7 @@
 						} catch (AxisFault e) {
 							throw new SandeshaException (e.getMessage());
 						}
-						
-
-						if (msgNo==3)
-							return;
-						
+									
 						//undating the next mst to invoke
 						nextMsgno++;
 						nextMsgMgr.update(new NextMsgBean (sequenceId,nextMsgno));

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?rev=293560&r1=293559&r2=293560&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Tue Oct  4 00:37:52 2005
@@ -100,10 +100,13 @@
 				&& (Constants.QOS.InvocationType.DEFAULT_INVOCATION_TYPE == Constants.QOS.InvocationType.EXACTLY_ONCE)) {
 			//this is a duplicate message and the invocation type is
 			// EXACTLY_ONCE.
-			throw new SandeshaException(
-					"Duplicate message - Invocation type is EXACTLY_ONCE");
+			
+			//throw new SandeshaException(
+			//		"Duplicate message - Invocation type is EXACTLY_ONCE");
 
-			//FIXME - return instead of sending a fault.
+			//TODO is this enough
+			msgCtx.setPausedTrue(new QName (Constants.IN_HANDLER_NAME));
+			
 		}
 
 		if (messagesStr != "" && messagesStr != null)
@@ -180,7 +183,7 @@
 			}
 
 		} else {
-			//TODO Add async Ack
+		  	//TODO Add async Ack
 		}
 
 		//		Pause the messages bean if not the right message to invoke.
@@ -196,61 +199,59 @@
 
 		long nextMsgno = bean.getNextMsgNoToProcess();
 
-		//Have to pause the message anyway
-		msgCtx.setPausedTrue(new QName(Constants.IN_HANDLER_NAME));
-		
-		
-		//Adding an entry in the SequencesToInvoke List  TODO - add this to a module init kind of place.
-		SequencePropertyBean incomingSequenceListBean =  (SequencePropertyBean) seqPropMgr.retrieve(sequenceId,Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
-		
-		if (incomingSequenceListBean==null) { 
-			ArrayList incomingSequenceList = new ArrayList ();
-			incomingSequenceListBean = new SequencePropertyBean ();
-			incomingSequenceListBean.setSequenceId(Constants.SequenceProperties.ALL_SEQUENCES);
-			incomingSequenceListBean.setName(Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
-			incomingSequenceListBean.setValue(incomingSequenceList);
-			
-			seqPropMgr.insert(incomingSequenceListBean);
-		}
-		
-		//This must be a List :D
-		ArrayList incomingSequenceList = (ArrayList) incomingSequenceListBean.getValue();
-		
-		//Adding current sequence to the incoming sequence List.
-		if (!incomingSequenceList.contains(sequenceId)){
-			incomingSequenceList.add(sequenceId);
-		}
-		
-		//saving the message.
-		try {
-			String key = SandeshaUtil.storeMessageContext(rmMsgCtx
-					.getMessageContext());
-			storageMapMgr
-					.insert(new StorageMapBean(key, msgNo, sequenceId));
-
-			//This will avoid performing application processing more than
-			// once.
-			rmMsgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE,
-					"true");
+		if (Constants.QOS.DeliveryAssurance.DEFAULT_DELIVERY_ASSURANCE == Constants.QOS.DeliveryAssurance.IN_ORDER) {
+			//pause the message
+			msgCtx.setPausedTrue(new QName(Constants.IN_HANDLER_NAME));
+
+			//Adding an entry in the SequencesToInvoke List TODO - add this to
+			// a module init kind of place.
+			SequencePropertyBean incomingSequenceListBean = (SequencePropertyBean) seqPropMgr
+					.retrieve(sequenceId,
+							Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
+
+			if (incomingSequenceListBean == null) {
+				ArrayList incomingSequenceList = new ArrayList();
+				incomingSequenceListBean = new SequencePropertyBean();
+				incomingSequenceListBean
+						.setSequenceId(Constants.SequenceProperties.ALL_SEQUENCES);
+				incomingSequenceListBean
+						.setName(Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
+				incomingSequenceListBean.setValue(incomingSequenceList);
+
+				seqPropMgr.insert(incomingSequenceListBean);
+			}
+
+			//This must be a List :D
+			ArrayList incomingSequenceList = (ArrayList) incomingSequenceListBean
+					.getValue();
+
+			//Adding current sequence to the incoming sequence List.
+			if (!incomingSequenceList.contains(sequenceId)) {
+				incomingSequenceList.add(sequenceId);
+			}
+
+			//saving the message.
+			try {
+				String key = SandeshaUtil.storeMessageContext(rmMsgCtx
+						.getMessageContext());
+				storageMapMgr
+						.insert(new StorageMapBean(key, msgNo, sequenceId));
+
+				//This will avoid performing application processing more than
+				// once.
+				rmMsgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE,
+						"true");
+
+			} catch (Exception ex) {
+				throw new SandeshaException(ex.getMessage());
+			}
+
+			//Starting the invoker if stopped.
+			SandeshaUtil.startInvokerIfStopped(msgCtx.getSystemContext());
 
-		} catch (Exception ex) {
-			throw new SandeshaException(ex.getMessage());
 		}
-		
-		//Starting the invoker if stopped.
-		SandeshaUtil.startInvokerIfStopped(msgCtx.getSystemContext());
-		
-		
 
 	}
-
-//	public synchronized void letInvoke() {
-//		letInvoke = true;
-//	}
-//
-//	public synchronized boolean isLetInvoke() {
-//		return letInvoke;
-//	}
 
 	//TODO convert following from INT to LONG
 	private boolean msgNoPresentInList(String list, long no) {



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org