You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2006/05/16 10:24:49 UTC
svn commit: r406872 - in
/webservices/sandesha/trunk/src/org/apache/sandesha2: ./ client/ handlers/
msgprocessors/ msgreceivers/ transport/ util/ workers/
Author: chamikara
Date: Tue May 16 01:24:44 2006
New Revision: 406872
URL: http://svn.apache.org/viewcvs?rev=406872&view=rev
Log:
Messages taken from a persistent storage are reinjected to the system, before invoking.
(RM handlers will not do any work in reinjection).
Corrections to the ServiceClient.
A new class MessageValidator to do validation beore processing a message.
Added:
webservices/sandesha/trunk/src/org/apache/sandesha2/MessageValidator.java
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.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/AckRequestedProcessor.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/msgprocessors/CloseSequenceProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
webservices/sandesha/trunk/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/AcknowledgementManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/TerminateManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/MessageValidator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/MessageValidator.java?rev=406872&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/MessageValidator.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/MessageValidator.java Tue May 16 01:24:44 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package org.apache.sandesha2;
+
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.util.SandeshaUtil;
+import org.apache.sandesha2.util.SpecSpecificConstants;
+
+public class MessageValidator {
+
+ public static void validateMessage (RMMsgContext rmMsg,StorageManager storageManager) throws SandeshaException {
+
+ if (rmMsg.getMessageType()!=Sandesha2Constants.MessageTypes.CREATE_SEQ
+ && rmMsg.getMessageType()!=Sandesha2Constants.MessageTypes.UNKNOWN) {
+
+ String sequenceID = SandeshaUtil.getSequenceIDFromRMMessage(rmMsg);
+
+ if (sequenceID!=null) {
+ String rmVersionOfSequence = SandeshaUtil.getSequenceProperty(sequenceID,Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION,storageManager);
+ String addressingNamespaceOfSequence = SandeshaUtil.getSequenceProperty(sequenceID,Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE,storageManager);
+
+ String rmNamespaceOfMsg = rmMsg.getRMNamespaceValue();
+ String rmNamespaceOfSequence = null;
+ if (rmVersionOfSequence!=null)
+ rmNamespaceOfSequence = SpecSpecificConstants.getRMNamespaceValue(rmVersionOfSequence);
+ String addressingNamespaceOfMsg = rmMsg.getAddressingNamespaceValue();
+
+ if (rmNamespaceOfSequence!=null && !rmNamespaceOfSequence.equals(rmNamespaceOfMsg)) {
+ String message = "Validation failed. The RM namespace of the message does not match with the sequence";
+ throw new SandeshaException (message);
+ }
+
+ if (addressingNamespaceOfSequence!=null && !addressingNamespaceOfSequence.equals(addressingNamespaceOfMsg)) {
+ String message = "Validation failed. The Addressing namespace of the message does not match with the sequence";
+ throw new SandeshaException (message);
+ }
+
+ //TODO do validation based on states
+ }
+ }
+ }
+}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java Tue May 16 01:24:44 2006
@@ -495,4 +495,7 @@
String STORAGE_MANAGER_PARAMETER = "Sandesha2StorageManager";
+ String POST_FAILURE_MESSAGE = "PostFailureMessage";
+
+ String REINJECTED_MESSAGE = "ReinjectedMessage";
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.java Tue May 16 01:24:44 2006
@@ -335,7 +335,7 @@
}
- public static void createSequnce(ServiceClient serviceClient, boolean offer, String sequenceKey)
+ public static void createSequence(ServiceClient serviceClient, boolean offer, String sequenceKey)
throws SandeshaException {
Options options = serviceClient.getOptions();
@@ -349,6 +349,16 @@
options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, oldSequenceKey);
}
+
+ /**
+ * User can terminate the sequence defined by the passed serviceClient.
+ *
+ * @deprecated
+ */
+ public static void createSequnce(ServiceClient serviceClient, boolean offer, String sequenceKey)
+ throws SandeshaException {
+ createSequence(serviceClient,offer,sequenceKey);
+ }
/**
* User can terminate the sequence defined by the passed serviceClient.
@@ -446,6 +456,12 @@
if (options == null)
throw new SandeshaException("Options object is not set");
+ String specVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
+ if (!Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(specVersion)) {
+ String message = "Close Sequence feature is only available for WSRM 1.1";
+ throw new SandeshaException (message);
+ }
+
String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
closeSequence(serviceClient);
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=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java Tue May 16 01:24:44 2006
@@ -32,7 +32,6 @@
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
import org.apache.axis2.context.OperationContextFactory;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -70,6 +69,10 @@
SOAPEnvelope envelope = msgContext.getEnvelope();
if (envelope == null)
throw new SandeshaException("SOAP envelope is not set");
+
+ String reinjectedMessage = (String) msgContext.getProperty(Sandesha2Constants.REINJECTED_MESSAGE);
+ if (reinjectedMessage!=null && Sandesha2Constants.VALUE_TRUE.equals(reinjectedMessage))
+ return; //Reinjected messages are not processed by Sandesha2 inflow handlers
StorageManager storageManager = null;
try {
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=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Tue May 16 01:24:44 2006
@@ -26,6 +26,7 @@
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.MessageValidator;
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.Sandesha2Constants;
import org.apache.sandesha2.SandeshaException;
@@ -64,6 +65,10 @@
if (null != DONE && "true".equals(DONE))
return;
+ String reinjectedMessage = (String) msgCtx.getProperty(Sandesha2Constants.REINJECTED_MESSAGE);
+ if (reinjectedMessage!=null && Sandesha2Constants.VALUE_TRUE.equals(reinjectedMessage))
+ return; //Reinjected messages are not processed by Sandesha2 inflow handlers
+
StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context,context.getAxisConfiguration());
boolean withinTransaction = false;
@@ -96,6 +101,10 @@
log.debug(message);
throw new AxisFault(message);
}
+
+
+ //validating the message
+ MessageValidator.validateMessage(rmMsgCtx,storageManager);
MsgProcessor msgProcessor = MsgProcessorFactory.getMessageProcessor(rmMsgCtx);
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=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java Tue May 16 01:24:44 2006
@@ -20,7 +20,6 @@
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContextFactory;
@@ -30,7 +29,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.Sandesha2Constants;
-import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.client.SandeshaClientConstants;
import org.apache.sandesha2.msgprocessors.ApplicationMsgProcessor;
import org.apache.sandesha2.msgprocessors.MsgProcessor;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java Tue May 16 01:24:44 2006
@@ -32,7 +32,6 @@
import org.apache.axis2.context.OperationContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.AxisEngine;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java Tue May 16 01:24:44 2006
@@ -24,7 +24,6 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.AxisEngine;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Tue May 16 01:24:44 2006
@@ -31,7 +31,6 @@
import org.apache.axis2.context.OperationContextFactory;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.transport.TransportSender;
@@ -379,7 +378,8 @@
}
RMMsgContext ackRMMessage = AcknowledgementManager.generateAckMessage(rmMsgCtx,sequenceId,storageManager);
-
+
+
AxisEngine engine = new AxisEngine (configCtx);
try {
@@ -391,7 +391,6 @@
}
public void processOutMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
-
MessageContext msgContext = rmMsgCtx.getMessageContext();
ConfigurationContext configContext = msgContext .getConfigurationContext();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java Tue May 16 01:24:44 2006
@@ -5,7 +5,6 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.util.Utils;
import org.apache.sandesha2.RMMsgContext;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java Tue May 16 01:24:44 2006
@@ -24,7 +24,6 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java Tue May 16 01:24:44 2006
@@ -19,13 +19,12 @@
import java.util.Iterator;
+import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.RelatesTo;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axiom.soap.SOAPFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.RMMsgContext;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java Tue May 16 01:24:44 2006
@@ -28,7 +28,6 @@
import org.apache.axis2.context.OperationContext;
import org.apache.axis2.context.OperationContextFactory;
import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.OutInAxisOperation;
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.engine.AxisEngine;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java Tue May 16 01:24:44 2006
@@ -24,7 +24,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.RMMsgContext;
-import org.apache.sandesha2.handlers.SandeshaGlobalInHandler;
import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.SandeshaUtil;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java Tue May 16 01:24:44 2006
@@ -45,10 +45,11 @@
StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,axisConfiguration);
+ msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING,Sandesha2Constants.VALUE_TRUE);
storageManager.updateMessageContext(key,msgContext);
- msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING,Sandesha2Constants.VALUE_TRUE);
+
}
//Below methods are not used
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/AcknowledgementManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/AcknowledgementManager.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/AcknowledgementManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/AcknowledgementManager.java Tue May 16 01:24:44 2006
@@ -39,7 +39,6 @@
import org.apache.sandesha2.Sandesha2Constants;
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.storage.StorageManager;
-import org.apache.sandesha2.storage.Transaction;
import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beans.SenderBean;
@@ -94,8 +93,12 @@
long timeNow = System.currentTimeMillis();
if (ackBean.getTimeToSend() > timeNow) {
- //Piggybacking will happen only if the end of ack interval (timeToSend) is not reached.
+// //Piggybacking will happen only if the end of ack interval (timeToSend) is not reached.
+ boolean disablePiggybacking = false;
+ if (disablePiggybacking)
+ continue piggybackLoop;
+
MessageContext ackMsgContext = storageManager
.retrieveMessageContext(ackBean.getMessageContextRefKey(),configurationContext);
@@ -105,12 +108,12 @@
continue piggybackLoop;
}
- String ackSequenceID = ackBean.getSequenceID();
+// String ackSequenceID = ackBean.getSequenceID();
- //sequenceID has to match for piggybacking
- if (!ackSequenceID.equals(sequnceID)) {
- continue piggybackLoop;
- }
+// //sequenceID has to match for piggybacking
+// if (!ackSequenceID.equals(sequnceID)) {
+// continue piggybackLoop;
+// }
//deleting the ack entry.
retransmitterBeanMgr.delete(ackBean.getMessageID());
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java Tue May 16 01:24:44 2006
@@ -20,8 +20,6 @@
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisDescription;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.Sandesha2Constants;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java Tue May 16 01:24:44 2006
@@ -329,10 +329,12 @@
public static StorageManager getSandeshaStorageManager(ConfigurationContext context,AxisDescription description) throws SandeshaException {
Parameter parameter = description.getParameter(Sandesha2Constants.STORAGE_MANAGER_PARAMETER);
- if (parameter==null)
+ if (parameter==null) {
parameter = new Parameter (Sandesha2Constants.STORAGE_MANAGER_PARAMETER,Sandesha2Constants.DEFAULT_STORAGE_MANAGER);
+ }
String value = (String) parameter.getValue();
+
if (Sandesha2Constants.INMEMORY_STORAGE_MANAGER.equals(value))
return getInMemoryStorageManager(context);
else if (Sandesha2Constants.PERMANENT_STORAGE_MANAGER.equals(value))
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java Tue May 16 01:24:44 2006
@@ -28,7 +28,6 @@
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.client.SandeshaClientConstants;
import org.apache.sandesha2.storage.StorageManager;
-import org.apache.sandesha2.storage.Transaction;
import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beans.NextMsgBean;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/TerminateManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/TerminateManager.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/TerminateManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/TerminateManager.java Tue May 16 01:24:44 2006
@@ -27,7 +27,6 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.engine.AxisEngine;
import org.apache.commons.logging.Log;
@@ -36,7 +35,6 @@
import org.apache.sandesha2.Sandesha2Constants;
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.storage.StorageManager;
-import org.apache.sandesha2.storage.Transaction;
import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java?rev=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java Tue May 16 01:24:44 2006
@@ -21,9 +21,9 @@
import java.util.Iterator;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperationFactory;
import org.apache.axis2.engine.AxisEngine;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -174,22 +174,41 @@
try {
//Invoking the message.
msgToInvoke.setProperty(Sandesha2Constants.WITHIN_TRANSACTION,Sandesha2Constants.VALUE_TRUE);
- new AxisEngine (msgToInvoke.getConfigurationContext())
- .resume(msgToInvoke);
- invoked = true;
- storageMapMgr.delete(key);
+
+ boolean postFailureInvocation = false;
+
+ //StorageManagers should st following property to true, to indicate that the message received comes after a failure.
+ String postFaulureProperty = (String) msgToInvoke.getProperty(Sandesha2Constants.POST_FAILURE_MESSAGE);
+ if (postFaulureProperty!=null && Sandesha2Constants.VALUE_TRUE.equals(postFaulureProperty))
+ postFailureInvocation = true;
- //removing the corresponding message context as well.
- MessageContext msgCtx = storageManager.retrieveMessageContext(key,context);
- if (msgCtx!=null) {
- storageManager.removeMessageContext(key);
+ AxisEngine engine = new AxisEngine (context);
+ if (postFailureInvocation) {
+ makeMessageReadyForReinjection (msgToInvoke);
+ engine.receive(msgToInvoke);
+ } else {
+ engine.resume(msgToInvoke);
}
+
+ invoked = true;
+
} catch (AxisFault e) {
throw new SandeshaException(e);
} finally {
transaction = storageManager.getTransaction();
}
+ //Service will be invoked only once. I.e. even if an exception get thrown in invocation
+ //the service will not be invoked again.
+ storageMapMgr.delete(key);
+
+ //removing the corresponding message context as well.
+ MessageContext msgCtx = storageManager.retrieveMessageContext(key,context);
+ if (msgCtx!=null) {
+ storageManager.removeMessageContext(key);
+ }
+
+
//undating the next msg to invoke
if (rmMsg.getMessageType() == Sandesha2Constants.MessageTypes.APPLICATION) {
@@ -233,5 +252,13 @@
}
}
}
+ }
+
+ private void makeMessageReadyForReinjection (MessageContext messageContext) {
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,null);
+ messageContext.getOptions().setMessageId(null);
+ messageContext.getOptions().setTo(null);
+ messageContext.getOptions().setAction(null);
+ messageContext.setProperty(Sandesha2Constants.REINJECTED_MESSAGE,Sandesha2Constants.VALUE_TRUE);
}
}
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=406872&r1=406871&r2=406872&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Tue May 16 01:24:44 2006
@@ -29,7 +29,6 @@
import org.apache.axis2.transport.TransportSender;
import org.apache.axis2.transport.TransportUtils;
import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.util.threadpool.ThreadPool;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.RMMsgContext;
@@ -150,7 +149,7 @@
}
RMMsgContext rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
-
+
//operation is the lowest level Sandesha2 should be attached
ArrayList msgsNotToSend = SandeshaUtil.getPropertyBean(msgCtx.getAxisOperation()).getMsgTypesToDrop();
@@ -164,7 +163,6 @@
if (messageType == Sandesha2Constants.MessageTypes.APPLICATION) {
Sequence sequence = (Sequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
String sequenceID = sequence.getIdentifier().getIdentifier();
-
}
//checking weather this message can carry piggybacked acks
@@ -235,7 +233,7 @@
// TODO : when this is the client side throw the exception to
// the client when necessary.
-
+
if (transaction!=null) {
try {
transaction.rollback();
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org