Author: mlovett
Date: Fri Feb  2 04:48:22 2007
New Revision: 502591

URL: http://svn.apache.org/viewvc?view=rev&rev=502591
Log:
Refactor sync-2-way with RM 1.0 so that is is treated as a very specific poll

Modified:
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SenderBean.java

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java?view=diff&rev=502591&r1=502590&r2=502591
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
 Fri Feb  2 04:48:22 2007
@@ -481,8 +481,6 @@
        
        static final String MSG_NO_OF_IN_MSG = "MsgNoOfInMsg";
        
-       static final String DUPLICATE_MESSAGE = "DuplicateMessage";
-       
        static final String MAKE_CONNECTION_RESPONSE = "MakeConnectionResponse";
        
        //In RM 1.1 AnonRMURI case we may not be terminating a request sequence 
unless the response side create sequence 

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?view=diff&rev=502591&r1=502590&r2=502591
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
 Fri Feb  2 04:48:22 2007
@@ -33,11 +33,14 @@
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.i18n.SandeshaMessageHelper;
 import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.msgprocessors.MakeConnectionProcessor;
 import org.apache.sandesha2.msgprocessors.SequenceProcessor;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.Transaction;
 import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
 import org.apache.sandesha2.storage.beans.RMDBean;
+import org.apache.sandesha2.storage.beans.SenderBean;
 import org.apache.sandesha2.util.MsgInitializer;
 import org.apache.sandesha2.util.Range;
 import org.apache.sandesha2.util.RangeString;
@@ -105,26 +108,48 @@
                        transaction = storageManager.getTransaction();
 
                        RMMsgContext rmMessageContext = 
MsgInitializer.initializeMessage(msgContext);
-                       
-                       //checking weather the Message belongs to the WSRM 1.0 
Anonymous InOut scenario.
-                       //If so instead of simply dropping duplicates we will 
have to attach the corresponding response,
-                       //as long as the Message has not been acked.            
        
-                       
                        EndpointReference replyTo = msgContext.getReplyTo();
                        String specVersion = 
rmMessageContext.getRMSpecVersion();
                                
                        boolean duplicateMessage = isDuplicateMessage 
(rmMessageContext, storageManager);
-                       if (duplicateMessage)
-                               
msgContext.setProperty(Sandesha2Constants.DUPLICATE_MESSAGE, Boolean.TRUE);
 
-                       boolean dropDuplicates = true;
-                       if ((replyTo!=null && replyTo.hasAnonymousAddress()) &&
-                                       (specVersion!=null && 
specVersion.equals(Sandesha2Constants.SPEC_VERSIONS.v1_0)))
-                                       dropDuplicates = false;
+                       //checking weather the Message belongs to the WSRM 1.0 
Anonymous InOut scenario.
+                       //If so instead of simply dropping duplicates we will 
have to attach the corresponding response,
+                       //as long as the Message has not been acked.            
        
+                       if (duplicateMessage &&
+                                       (replyTo==null || 
replyTo.hasAnonymousAddress()) &&
+                                       (specVersion!=null && 
specVersion.equals(Sandesha2Constants.SPEC_VERSIONS.v1_0))) {
+
+                               // Treat the duplicate message as a special 
kind of poll
+                               Sequence sequence = (Sequence) 
rmMessageContext.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
+                               
+                           SenderBeanMgr senderBeanMgr = 
storageManager.getSenderBeanMgr();
+                           SenderBean findSenderBean = new SenderBean ();
+                           
findSenderBean.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
+                           
findSenderBean.setInboundSequenceId(sequence.getIdentifier().getIdentifier());
+                           
findSenderBean.setInboundMessageNumber(sequence.getMessageNumber().getMessageNumber());
+                           findSenderBean.setSend(true);
+               
+                           SenderBean replyMessageBean = 
senderBeanMgr.findUnique(findSenderBean);
+                           
+                           // this is effectively a poll for the replyMessage, 
wo re-use the logic in the MakeConnection
+                           // processor. This will use this thread to re-send 
the reply, writing it into the transport.
+                           // As the reply is now written we do not want to 
continue processing, or suspend, so we abort.
+                           if(replyMessageBean != null) {
+                               if(log.isDebugEnabled()) log.debug("Found 
matching reply for replayed message");
+                               
MakeConnectionProcessor.replyToPoll(rmMessageContext, replyMessageBean, 
storageManager, false, null);
+                           } else {
+                               if(log.isDebugEnabled()) log.debug("No matching 
reply for replayed message");
+                           }
+                           
+                           returnValue = InvocationResponse.ABORT;
+                               if (log.isDebugEnabled()) log.debug("Exit: 
SandeshaGlobalInHandler::invoke " + returnValue);
+                               return returnValue;
+                       }
                        
                        boolean shouldMessageBeDropped = shouldMessageBeDropped 
(rmMessageContext, storageManager);
                        
-                       if ((duplicateMessage && dropDuplicates) || 
shouldMessageBeDropped) {
+                       if (duplicateMessage || shouldMessageBeDropped) {
 
                                returnValue = InvocationResponse.ABORT; // the 
msg has been
                                                                                
                                // dropped

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?view=diff&rev=502591&r1=502590&r2=502591
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
 Fri Feb  2 04:48:22 2007
@@ -24,8 +24,6 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.transport.RequestResponseTransport;
-import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.MessageValidator;
@@ -224,19 +222,8 @@
                                String acksToAddress = rmdBean.getAcksToEPR();
                                
                                EndpointReference acksTo = new 
EndpointReference (acksToAddress);
-                               EndpointReference replyTo = 
msgContext.getReplyTo();
                                
-                               String mep = 
msgContext.getAxisOperation().getMessageExchangePattern();
-                               String specVersion = 
rmMsgContext.getRMSpecVersion();
-                               
-                               if (replyTo!=null && 
replyTo.hasAnonymousAddress() && 
-                                       
!WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(mep)){
-                                       
-                                       //for RM 1.0 this is done to attach a 
sync response using the RequestResponseTransport
-                                       if (specVersion!=null && 
specVersion.equals(Sandesha2Constants.SPEC_VERSIONS.v1_0))
-                                               
msgContext.setProperty(RequestResponseTransport.HOLD_RESPONSE, Boolean.TRUE);
-                                       
-                               } else if (acksTo!=null && 
acksTo.hasAnonymousAddress()) {
+                               if (acksTo!=null && 
acksTo.hasAnonymousAddress()) {
                                        
                                        Object responseWritten = 
msgContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN);
                                        if (responseWritten==null || 
!Constants.VALUE_TRUE.equals(responseWritten)) {

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?view=diff&rev=502591&r1=502590&r2=502591
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
 Fri Feb  2 04:48:22 2007
@@ -120,7 +120,8 @@
                                     
.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
                     if (sequencePart != null) {
                                String incomingSeqId = 
sequencePart.getIdentifier().getIdentifier();
-                               msgProcessor = new 
ApplicationMsgProcessor(incomingSeqId);// a rm intended message
+                               long incomingMessageNumber = 
sequencePart.getMessageNumber().getMessageNumber();
+                               msgProcessor = new 
ApplicationMsgProcessor(incomingSeqId, incomingMessageNumber);
                     }
                 } else // if client side.
                     msgProcessor = new ApplicationMsgProcessor();

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?view=diff&rev=502591&r1=502590&r2=502591
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
 Fri Feb  2 04:48:22 2007
@@ -66,13 +66,15 @@
        private static final Log log = 
LogFactory.getLog(ApplicationMsgProcessor.class);
 
        private String inboundSequence = null;
+       private long   inboundMessageNumber;
        
        public ApplicationMsgProcessor() {
                // Nothing to do
        }
        
-       public ApplicationMsgProcessor(String inboundSequenceId) {
+       public ApplicationMsgProcessor(String inboundSequenceId, long 
inboundMessageNumber) {
                this.inboundSequence = inboundSequenceId;
+               this.inboundMessageNumber = inboundMessageNumber;
        }
        
        public boolean processInMessage(RMMsgContext rmMsgCtx) {
@@ -634,6 +636,8 @@
                appMsgEntry.setMessageNumber(messageNumber);
                appMsgEntry.setLastMessage(lastMessage);
                
appMsgEntry.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
+               appMsgEntry.setInboundSequenceId(inboundSequence);
+               appMsgEntry.setInboundMessageNumber(inboundMessageNumber);
                if (outSequenceID == null) {
                        appMsgEntry.setSend(false);
                } else {

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java?view=diff&rev=502591&r1=502590&r2=502591
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
 Fri Feb  2 04:48:22 2007
@@ -104,28 +104,40 @@
                        if(log.isDebugEnabled()) log.debug("Exit: 
MakeConnectionProcessor::processInMessage, no matching message found");
                        return false;
                }
-                       
-               TransportOutDescription transportOut = 
rmMsgCtx.getMessageContext().getTransportOut();
+               
+               replyToPoll(rmMsgCtx, senderBean, storageManager, pending, 
makeConnection.getNamespaceValue());
+               
+               return false;
+       }
+       
+       public static void replyToPoll(RMMsgContext pollMessage,
+                       SenderBean matchingMessage,
+                       StorageManager storageManager,
+                       boolean pending,
+                       String namespace)
+       throws AxisFault
+       {
+               TransportOutDescription transportOut = 
pollMessage.getMessageContext().getTransportOut();
                if (transportOut==null) {
                        String message = SandeshaMessageHelper.getMessage(
                                        
SandeshaMessageKeys.cantSendMakeConnectionNoTransportOut);
                        throw new SandeshaException (message);
                }
                        
-               String messageStorageKey = senderBean.getMessageContextRefKey();
-               MessageContext returnMessage = 
storageManager.retrieveMessageContext(messageStorageKey,configurationContext);
+               String messageStorageKey = 
matchingMessage.getMessageContextRefKey();
+               MessageContext returnMessage = 
storageManager.retrieveMessageContext(messageStorageKey,pollMessage.getConfigurationContext());
                if (returnMessage==null) {
                        String message = "Cannot find the message stored with 
the key:" + messageStorageKey;
                        throw new SandeshaException (message);
                }
                
-               if(pending) addMessagePendingHeader(returnMessage, 
makeConnection.getNamespaceValue());
+               if(pending) addMessagePendingHeader(returnMessage, namespace);
                
                RMMsgContext returnRMMsg = 
MsgInitializer.initializeMessage(returnMessage);
-               setTransportProperties (returnMessage, rmMsgCtx);
+               setTransportProperties (returnMessage, pollMessage);
                
                // Link the response to the request
-               OperationContext context = 
rmMsgCtx.getMessageContext().getOperationContext();
+               OperationContext context = 
pollMessage.getMessageContext().getOperationContext();
                context.addMessageContext(returnMessage);
                returnMessage.setOperationContext(context);
                
@@ -135,15 +147,13 @@
                //This will allow Sandesha2 to consider both of following 
senarios equally.
                //      1. A message being sent by the Sender thread.
                //  2. A message being sent as a reply to an MakeConnection.
-               SenderWorker worker = new SenderWorker (configurationContext, 
senderBean);
+               SenderWorker worker = new SenderWorker 
(pollMessage.getConfigurationContext(), matchingMessage);
                worker.setMessage(returnRMMsg);
 
                worker.run();
-               
-               return false;
        }
        
-       private void addMessagePendingHeader (MessageContext returnMessage, 
String namespace) throws SandeshaException {
+       private static void addMessagePendingHeader (MessageContext 
returnMessage, String namespace) throws SandeshaException {
                MessagePending messagePending = new MessagePending(namespace);
                messagePending.setPending(true);
                messagePending.toSOAPEnvelope(returnMessage.getEnvelope());
@@ -153,7 +163,7 @@
                return false;
        }
 
-       private void setTransportProperties (MessageContext returnMessage, 
RMMsgContext makeConnectionMessage) {
+       private static void setTransportProperties (MessageContext 
returnMessage, RMMsgContext makeConnectionMessage) {
         
returnMessage.setProperty(MessageContext.TRANSPORT_OUT,makeConnectionMessage.getProperty(MessageContext.TRANSPORT_OUT));
         
returnMessage.setProperty(Constants.OUT_TRANSPORT_INFO,makeConnectionMessage.getProperty(Constants.OUT_TRANSPORT_INFO));
         

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java?view=diff&rev=502591&r1=502590&r2=502591
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
 Fri Feb  2 04:48:22 2007
@@ -17,9 +17,6 @@
 
 package org.apache.sandesha2.msgprocessors;
 
-import java.util.Iterator;
-import java.util.List;
-
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
@@ -29,9 +26,7 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.engine.Handler.InvocationResponse;
-import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -46,14 +41,10 @@
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
 import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
-import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
 import org.apache.sandesha2.storage.beans.InvokerBean;
 import org.apache.sandesha2.storage.beans.RMDBean;
-import org.apache.sandesha2.storage.beans.RMSBean;
-import org.apache.sandesha2.storage.beans.SenderBean;
 import org.apache.sandesha2.util.AcknowledgementManager;
 import org.apache.sandesha2.util.FaultManager;
-import org.apache.sandesha2.util.MsgInitializer;
 import org.apache.sandesha2.util.Range;
 import org.apache.sandesha2.util.RangeString;
 import org.apache.sandesha2.util.SandeshaUtil;
@@ -162,97 +153,8 @@
                        bean.setLastInMessageId(msgCtx.getMessageID());
                }
                
-               //Check weather this is a duplicate message. Normally duplicate 
messages get dropped at the SandeshaGlobalInHandler
-               //But they can reach here if they belonged to the WSRM 1.0 
Anonymous InOut Scenario
                EndpointReference replyTo = rmMsgCtx.getReplyTo();
-               String specVersion = rmMsgCtx.getRMSpecVersion();
-               Boolean duplicateMessage = (Boolean) 
rmMsgCtx.getProperty(Sandesha2Constants.DUPLICATE_MESSAGE);
                String mep = 
msgCtx.getAxisOperation().getMessageExchangePattern();
-               boolean syncReply = replyTo == null || 
replyTo.hasAnonymousAddress();
-               
-               if (syncReply && 
!WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(mep) && 
-                       (specVersion!=null && 
specVersion.equals(Sandesha2Constants.SPEC_VERSIONS.v1_0)) &&
-                       (duplicateMessage!=null && 
duplicateMessage.equals(Boolean.TRUE))){
-                       
-                   String outgoingSideInternalSequenceId = 
SandeshaUtil.getOutgoingSideInternalSequenceID(sequenceId);
-                   RMSBean rmsBean = 
SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, 
outgoingSideInternalSequenceId);
-                   if (rmsBean==null) {
-                       String message = "Cannot find a entries for the 
response side sequence";
-                       throw new SandeshaException (message);
-                   }
-                   
-                   String outgoingSideSequenceId = rmsBean.getSequenceID();
-                   if (outgoingSideSequenceId==null) {
-                       String message = "Outgoing side SequenceId has not been 
set";
-                       throw new SandeshaException (message);
-                   }
-                   
-                   SenderBeanMgr senderBeanMgr = 
storageManager.getSenderBeanMgr();
-                   SenderBean findSenderBean = new SenderBean ();
-                   findSenderBean.setSequenceID(outgoingSideSequenceId);
-                   
findSenderBean.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
-                   findSenderBean.setSend(true);
-                   
-                   List senderBeanList = senderBeanMgr.find(findSenderBean);
-                   for (Iterator it=senderBeanList.iterator();it.hasNext();) {
-                       SenderBean senderBean = (SenderBean) it.next();
-                       String messageContextKey = 
senderBean.getMessageContextRefKey();
-                       MessageContext outMessageContext = 
storageManager.retrieveMessageContext(messageContextKey, configCtx);
-                       
-                       Long msgNoOfInMsg = (Long) 
outMessageContext.getProperty(Sandesha2Constants.MSG_NO_OF_IN_MSG);
-                       if (msgNoOfInMsg == null) {
-                                       MessageContext inMsgContextOfOutMessage 
= outMessageContext.getOperationContext()
-                                                                               
                                          
.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-                                       RMMsgContext inRMMsgContextOfOutMessage 
= MsgInitializer.initializeMessage(inMsgContextOfOutMessage);
-
-                                       if (inMsgContextOfOutMessage != null) {
-                                               Sequence sequenceOfInMsg = 
(Sequence) 
inRMMsgContextOfOutMessage.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
-                                               if (sequenceOfInMsg == null) {
-                                                       String message = 
"Sender has an invalid application message. No sequence part";
-                                                       throw new 
SandeshaException(message);
-                                               }
-
-                                               long lng = 
sequenceOfInMsg.getMessageNumber().getMessageNumber();
-                                               msgNoOfInMsg = new Long(lng);
-                                               
outMessageContext.setProperty(Sandesha2Constants.MSG_NO_OF_IN_MSG, 
msgNoOfInMsg);
-
-                                               // storing again will make sure 
that this new property get persisted.
-                                               
storageManager.storeMessageContext(messageContextKey, outMessageContext);
-                                       }
-                               }
-                       
-                       if (msgNoOfInMsg != null) {
-                                       
-                                       //if this message has being processed 
before, attaching the previous response instead of invoking it again.
-                                       if 
(msgNoOfInMsg.longValue()==sequence.getMessageNumber().getMessageNumber()) {
-                                               OperationContext 
operationContext = msgCtx.getOperationContext();
-                                               
operationContext.addMessageContext(outMessageContext);
-                                               
-                                               
outMessageContext.setOperationContext(operationContext);
-                                               
outMessageContext.setProperty(MessageContext.TRANSPORT_OUT, 
msgCtx.getProperty(MessageContext.TRANSPORT_OUT));
-                                               
-                                               // pausing the thread, causing 
the transport to wait.
-                                               // Sender will send the 
outMessage correctly, using
-                                               // 
RequestResponseTransportListner.
-                                               
-                                               result = 
InvocationResponse.SUSPEND;
-                                               if (log.isDebugEnabled())
-                                                       log.debug("Exit: 
SequenceProcessor::processReliableMessage" + result);
-                                               return result;
-                                       }
-                               }
-                   }
-
-                   String message = "Cant process the message. Cant find a 
suitable out message context for the duplicate message";
-                       throw new SandeshaException (message);
-                   
-               } else if (duplicateMessage!=null && 
duplicateMessage.equals(Boolean.TRUE)) {
-                       // Abort processing this duplicate
-                       result = InvocationResponse.ABORT;
-                       if (log.isDebugEnabled())
-                               log.debug("Exit: 
SequenceProcessor::processReliableMessage, dropping duplicate: " + result);
-                       return result;
-               }               
                
                String key = SandeshaUtil.getUUID(); // key to store the 
message.
                // updating the Highest_In_Msg_No property which gives the 
highest

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SenderBean.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SenderBean.java?view=diff&rev=502591&r1=502590&r2=502591
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SenderBean.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SenderBean.java
 Fri Feb  2 04:48:22 2007
@@ -59,6 +59,12 @@
        private String toAddress;
        
        /**
+        * If this sender bean is handling a response message, then we record 
the sequence id
+        * of the inbound message that generated this response.
+        */
+       private String inboundSequence;
+       
+       /**
         * Comment for <code>send</code>
         * The sender will not send the message unless this property is true.
         */
@@ -101,6 +107,12 @@
        private boolean lastMessage = false;
        
        /**
+        * If this sender bean is handling a response message, then we record 
the message number
+        * of the inbound message that generated this response.
+        */
+       private long inboundMessageNumber;
+       
+       /**
         * Flags that are used to check if the primitive types on this bean
         * have been set. If a primitive type has not been set then it will
         * be ignored within the match method.
@@ -113,6 +125,7 @@
        private static final int TIME_TO_SEND_FLAG = 0x00010000;
        private static final int MSG_TYPE_FLAG     = 0x00100000;
        private static final int LAST_MSG_FLAG     = 0x01000000;
+       private static final int IN_MSG_NUM_FLAG   = 0x10000000;
 
        public SenderBean() {
 
@@ -232,6 +245,23 @@
                this.flags |= LAST_MSG_FLAG;
        }
        
+       public long getInboundMessageNumber() {
+               return inboundMessageNumber;
+       }
+
+       public void setInboundMessageNumber(long inboundMessageNumber) {
+               this.inboundMessageNumber = inboundMessageNumber;
+               this.flags |= IN_MSG_NUM_FLAG;
+       }
+
+       public String getInboundSequenceId() {
+               return inboundSequence;
+       }
+
+       public void setInboundSequenceId(String inboundSequence) {
+               this.inboundSequence = inboundSequence;
+       }
+
        public String toString() {
                StringBuffer result = new StringBuffer();
                // There is a lot of data in this bean, so we don't trace it 
all.
@@ -266,6 +296,9 @@
 
                else if(bean.getToAddress() != null && 
!bean.getToAddress().equals(this.getToAddress()))
                        match = false;
+
+               else if(bean.getInboundSequenceId() != null && 
!bean.getInboundSequenceId().equals(this.getInboundSequenceId()))
+                       match = false;
                
                else if((bean.flags & SEND_FLAG) != 0 && bean.isSend() != 
this.isSend())
                        match = false;
@@ -287,6 +320,9 @@
                        match = false;
                
                else if((bean.flags & LAST_MSG_FLAG) != 0 && 
bean.isLastMessage() != this.isLastMessage())
+                       match = false;
+
+               else if((bean.flags & IN_MSG_NUM_FLAG) != 0 && 
bean.getInboundMessageNumber() != this.getInboundMessageNumber())
                        match = false;
 
                return match;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to