ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chamik...@apache.org
Subject svn commit: r331906 - in /webservices/sandesha/trunk/src/org/apache/sandesha2: ./ handlers/ msgprocessors/ workers/
Date Tue, 08 Nov 2005 22:16:12 GMT
Author: chamikara
Date: Tue Nov  8 14:15:32 2005
New Revision: 331906

URL: http://svn.apache.org/viewcvs?rev=331906&view=rev
Log:
Added facility to eccept empty-body last messages.
Made sure that the terminate message is sent only once.
Some bug fixes

Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.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=331906&r1=331905&r2=331906&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Tue Nov  8 14:15:32
2005
@@ -116,7 +116,7 @@
 	}
 
 	public interface WSP {
-		long RETRANSMISSION_INTERVAL = 10000;
+		long RETRANSMISSION_INTERVAL = 500000;
 		long ACKNOWLEDGEMENT_INTERVAL = 3000;
 		boolean EXPONENTION_BACKOFF = false;
 		long INACTIVITY_TIMEOUT_INTERVAL = 5000000;
@@ -190,6 +190,8 @@
 		String CHECK_RESPONSE = "CheckResponse";
 		
 		String OFFERED_SEQUENCE = "OfferedSequence";
+		
+		String TERMINATE_ADDED = "TerminateAdded";
 	}
 
 	public interface SOAPVersion {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?rev=331906&r1=331905&r2=331906&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
Tue Nov  8 14:15:32 2005
@@ -23,6 +23,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.soap.SOAPBody;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.SandeshaException;
@@ -83,6 +84,7 @@
 		boolean drop = false;
 
 		if (rmMsgContext.getMessageType() == Constants.MessageTypes.APPLICATION) {
+			
 			Sequence sequence = (Sequence) rmMsgContext
 					.getMessagePart(Constants.MessageParts.SEQUENCE);
 			String sequenceId = null;
@@ -112,6 +114,43 @@
 						drop = true;
 					}
 				}
+				
+				
+				if (drop==false) {
+					//Checking for RM specific EMPTY_BODY LASTMESSAGE.
+					SOAPBody body = rmMsgContext.getSOAPEnvelope().getBody();
+					boolean emptyBody = false;
+					if (body.getChildElements().hasNext()==false) {
+						emptyBody = true;	
+					}
+				
+					if (emptyBody) {
+						boolean lastMessage = false;
+						if (sequence.getLastMessage()!=null) {
+							System.out.println("Empty Body Last Message Received");
+							drop = true;
+						
+							if (receivedMsgsBean==null) {
+								receivedMsgsBean = new SequencePropertyBean (sequenceId,Constants.SequenceProperties.RECEIVED_MESSAGES,"");
+								seqPropMgr.insert(receivedMsgsBean);
+							}
+							
+							String receivedMsgStr = (String) receivedMsgsBean.getValue();
+							if (receivedMsgStr != "" && receivedMsgStr != null)
+								receivedMsgStr = receivedMsgStr + "," + Long.toString(msgNo);
+							else
+								receivedMsgStr = Long.toString(msgNo);
+								
+							receivedMsgsBean.setValue(receivedMsgStr);
+							seqPropMgr.update(receivedMsgsBean);
+								
+							//ApplicationMsgProcessor ackProcessor = new ApplicationMsgProcessor ();
+							//ackProcessor.sendAckIfNeeded(rmMsgContext,receivedMsgStr);
+							
+					}
+				}
+				}
+				//if (rmMsgContext.get)
 			}
 		}
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?rev=331906&r1=331905&r2=331906&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Tue
Nov  8 14:15:32 2005
@@ -49,6 +49,12 @@
 		if (context == null)
 			throw new AxisFault("ConfigurationContext is null");
 
+		String DONE = (String) msgCtx.getProperty(Constants.APPLICATION_PROCESSING_DONE);
+		if (null != DONE && "true".equals(DONE))
+			return;
+		
+		//Shouldnt set app-processing-done here SINCE - 
+
 		AxisService axisService = msgCtx.getAxisService();
 		if (axisService == null)
 			throw new AxisFault("AxisService is null");

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?rev=331906&r1=331905&r2=331906&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java Tue
Nov  8 14:15:32 2005
@@ -398,6 +398,7 @@
 			throw new SandeshaException(
 					"Create Sequence part is null for a CreateSequence message");
 
+	
 		SequenceOffer offer = createSequencePart.getSequenceOffer();
 		if (offer != null) {
 			//Offer processing
@@ -444,6 +445,10 @@
 				createSeqMsg.getMessageID(), null);
 		createSeqMgr.insert(createSeqBean);
 
+		if (createSeqMsg.getReplyTo()==null)
+			createSeqMsg.setReplyTo(new EndpointReference (Constants.WSA.NS_URI_ANONYMOUS));
+		
+		
 		RetransmitterBeanMgr retransmitterMgr = storageManager
 				.getRetransmitterBeanMgr();
 
@@ -597,8 +602,8 @@
 
 		//TODO do this based on policies.
 		boolean addAckRequested = false;
-//		if (!lastMessage)
-//			addAckRequested = true;
+		if (!lastMessage)
+			addAckRequested = true;
 
 		//setting the Sequnece id.
 		//Set send = true/false depending on the availability of the out

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java?rev=331906&r1=331905&r2=331906&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
Tue Nov  8 14:15:32 2005
@@ -83,7 +83,9 @@
 		//Because of this dispatching may go wrong.
 		//So we set relatesTo value to null for ackMessages. (this happens in
 		// the SandeshaGlobal handler)
-		rmMsgCtx.setRelatesTo(null);
+		//Do this only if this is a standalone ACK.
+		if (rmMsgCtx.getMessageType()==Constants.MessageTypes.ACK)
+			rmMsgCtx.setRelatesTo(null);
 
 		RetransmitterBean input = new RetransmitterBean();
 		input.setTempSequenceId(tempSequenceId);
@@ -166,15 +168,25 @@
 	public void addTerminateSequenceMessage(RMMsgContext incomingAckRMMsg,
 			String outSequenceId, String tempSequenceId)
 			throws SandeshaException {
+		
+		StorageManager storageManager = SandeshaUtil
+		.getSandeshaStorageManager(incomingAckRMMsg.getMessageContext()
+				.getSystemContext());
+		
+		SequencePropertyBeanMgr seqPropMgr = storageManager
+		.getSequencePropretyBeanMgr();
+		
+		SequencePropertyBean terminated = seqPropMgr.retrieve(outSequenceId,Constants.SequenceProperties.TERMINATE_ADDED);
+		
+		if (terminated!=null && terminated.getValue()!=null && "true".equals(terminated.getValue()))
{
+			System.out.println("TERMINATE WAS ADDED PREVIOUSLY....");
+			return;
+		}
+		
 		RMMsgContext terminateRMMessage = RMMsgCreator
 				.createTerminateSequenceMessage(incomingAckRMMsg, outSequenceId);
 
-		//detting addressing headers.
-		StorageManager storageManager = SandeshaUtil
-				.getSandeshaStorageManager(incomingAckRMMsg.getMessageContext()
-						.getSystemContext());
-		SequencePropertyBeanMgr seqPropMgr = storageManager
-				.getSequencePropretyBeanMgr();
+
 
 		//SequencePropertyBean replyToBean =
 		// seqPropMgr.retrieve(tempSequenceId,Constants.SequenceProperties.REPLY_TO_EPR);
@@ -220,6 +232,14 @@
 
 		RetransmitterBeanMgr retramsmitterMgr = storageManager
 				.getRetransmitterBeanMgr();
+		
+		SequencePropertyBean terminateAdded = new SequencePropertyBean ();
+		terminateAdded.setName(Constants.SequenceProperties.TERMINATE_ADDED);
+		terminateAdded.setSequenceId(outSequenceId);
+		terminateAdded.setValue("true");
+	    
+		seqPropMgr.insert(terminateAdded);
+		
 		retramsmitterMgr.insert(terminateBean);
 
 	}

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=331906&r1=331905&r2=331906&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
Tue Nov  8 14:15:32 2005
@@ -59,6 +59,8 @@
 
 	public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
 
+		//Object obj = rmMsgCtx.getProperty(Constants.APPLICATION_PROCESSING_DONE);
+		
 		//Processing for ack if any
 		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx
 				.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
@@ -356,8 +358,8 @@
 				throw new SandeshaException(e1.getMessage());
 			}
 		} else {
-			rmMsgCtx.getMessageContext().getOperationContext().setProperty(
-					org.apache.axis2.Constants.RESPONSE_WRITTEN, "false");
+			//rmMsgCtx.getMessageContext().getOperationContext().setProperty(
+				//	org.apache.axis2.Constants.RESPONSE_WRITTEN, "false");
 			
 			RetransmitterBeanMgr retransmitterBeanMgr = storageManager
 					.getRetransmitterBeanMgr();

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java?rev=331906&r1=331905&r2=331906&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Tue Nov  8 14:15:32
2005
@@ -83,6 +83,7 @@
 													.getMessageType())
 									+ "' message.");
 						}
+						
 
 						new AxisEngine(context).send(msgCtx);
 



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


Mime
View raw message