Author: amila Date: Mon Mar 3 03:52:53 2008 New Revision: 14449 Log:
upto now it sends the terminate message Modified: trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/handlers/MercuryInHandler.java trunk/commons/mercury/modules/test/src/org/wso2/mercury/test/client/AsyncInOutClient.java Modified: trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/handlers/MercuryInHandler.java ============================================================================== --- trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/handlers/MercuryInHandler.java (original) +++ trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/handlers/MercuryInHandler.java Mon Mar 3 03:52:53 2008 @@ -27,13 +27,13 @@ import org.wso2.mercury.state.RMSSequence; import org.wso2.mercury.state.RMDSequence; import org.wso2.mercury.exception.RMMessageBuildingException; -import org.wso2.mercury.message.CreateSequenceResponseMessage; -import org.wso2.mercury.message.RMApplicationMessage; -import org.wso2.mercury.message.SequenceAcknowledgmentMessage; -import org.wso2.mercury.message.TerminateSequenceMessage; +import org.wso2.mercury.message.*; import org.wso2.mercury.context.MercuryMessageContext; import org.wso2.mercury.persistence.exception.PersistenceException; +import java.util.List; +import java.util.ArrayList; + /** * this handler buffers the incoming Application messages and * send them accordingly. @@ -191,6 +191,19 @@ offerdRMSSequence.sendApplicationMessageResponse( msgContext, rmApplicationMessage.getMessageNumber()); } else { + + // once we got an application mesage we have to acknowledge this corresponding + // RMS Sequence. Here we have to keep in mind that the RMS have to repeat the + // request message util it gets the response message. + + RMSSequence offeredRMSSequence = rmdSequence.getOfferedRMSSequence(); + AcknowledgmentRange acknowledgmentRange = + new AcknowledgmentRange(rmApplicationMessage.getMessageNumber(), + rmApplicationMessage.getMessageNumber()); + List acknowledgmentRanges = new ArrayList(); + acknowledgmentRanges.add(acknowledgmentRange); + offeredRMSSequence.sequenceAcknowledgmentReceived(acknowledgmentRanges); + // this is an annonymous client response. this thread should have started // at the axis2 kernal level. but we can not let this thread proceed // all the sequence messages comes. here we wait this thread in Modified: trunk/commons/mercury/modules/test/src/org/wso2/mercury/test/client/AsyncInOutClient.java ============================================================================== --- trunk/commons/mercury/modules/test/src/org/wso2/mercury/test/client/AsyncInOutClient.java (original) +++ trunk/commons/mercury/modules/test/src/org/wso2/mercury/test/client/AsyncInOutClient.java Mon Mar 3 03:52:53 2008 @@ -70,6 +70,7 @@ serviceClient.engageModule("MessageDropModule"); serviceClient.engageModule("Mercury"); serviceClient.getOptions().setProperty(MercuryClientConstants.SEQUENCE_OFFER, Constants.VALUE_TRUE); + serviceClient.getOptions().setProperty(MercuryClientConstants.LAST_MESSAGE, Constants.VALUE_TRUE); sendAsynchornousMessage(serviceClient, 101, "Key1"); try { System.out.println("Waiting thread to sleep"); _______________________________________________ Commons-dev mailing list Commons-dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/commons-dev