Package org.apache.sandesha2.storage.beans

Examples of org.apache.sandesha2.storage.beans.SenderBean


        for (int rangeIndex=0; rangeIndex < newRanges.length; rangeIndex++) {
          //now work on each newly acked message in this range
          for(long messageNo = newRanges[rangeIndex].lowerValue; messageNo<=newRanges[rangeIndex].upperValue; messageNo++){
           
            numberOfNewMessagesAcked++;
            SenderBean matcher = new SenderBean();
            matcher.setSequenceID(outSequenceId);
           
            matcher.setMessageNumber(messageNo);
           
            List retransmitterBeans = retransmitterMgr.find(matcher);
            if (! retransmitterBeans.isEmpty()){
              Iterator retransmitterBeansItr = retransmitterBeans.iterator();
              while (retransmitterBeansItr.hasNext()) {
                SenderBean retransmitterBean = (SenderBean) retransmitterBeansItr.next();
                if (retransmitterBean != null) {
                  // Check we haven't got an Ack for a message that hasn't been sent yet !
                  if (retransmitterBean.getSentCount() == 0) {
                    FaultManager.makeInvalidAcknowledgementFault(rmMsgCtx, sequenceAck, ackRange,
                        storageManager, piggybackedAck);
                    if (log.isDebugEnabled())
                      log.debug("Exit: AcknowledgementProcessor::processAckHeader, Invalid Ack");
                    return;
                  }
                 
                  String storageKey = retransmitterBean.getMessageContextRefKey();
                 
                  boolean syncResponseNeeded = false;
                  if (Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmVersion) && anonReplyTo) {
                    MessageContext applicationMessage = storageManager.retrieveMessageContext(storageKey, configCtx);
                    AxisOperation operation = applicationMessage.getAxisOperation();
                    if(operation!= null) {
                      int mep = operation.getAxisSpecificMEPConstant();
                      syncResponseNeeded = (mep == WSDLConstants.MEP_CONSTANT_OUT_IN);
                    }
                  }

                  if (!syncResponseNeeded) {
                    // removing the application message from the storage.
                    retransmitterMgr.delete(retransmitterBean.getMessageID());
                    storageManager.removeMessageContext(storageKey);
                  }
                }               
              }             
            }//end of if (!retransmitterBeans.isEmpty()){
View Full Code Here


    rmsBeanMgr.update(rmsBean);
    SandeshaUtil.startWorkersForSequence(configCtx, rmsBean);

    // Locate and update all of the messages for this sequence, now that we know
    // the sequence id.
    SenderBean target = new SenderBean();
    target.setInternalSequenceID(internalSequenceId);
    target.setSend(false);
   
    Iterator iterator = retransmitterMgr.find(target).iterator();
    while (iterator.hasNext()) {
      SenderBean tempBean = (SenderBean) iterator.next();

      // asking to send the application msssage
      tempBean.setSend(true);
      tempBean.setSequenceID(newOutSequenceId);
      retransmitterMgr.update(tempBean);
    }

    // TODO - does this do anything?
    createSeqResponseRMMsgCtx.pause();
View Full Code Here

      // missed earlier acks. We also have special processing for sync 2-way with RM 1.0
      if((replyTo==null || replyTo.hasAnonymousAddress()) &&
         (specVersion!=null && specVersion.equals(Sandesha2Constants.SPEC_VERSIONS.v1_0))) {

        SenderBeanMgr senderBeanMgr = storageManager.getSenderBeanMgr();
        SenderBean findSenderBean = new SenderBean ();
       
        if (rmMsgCtx.getMessageType()==Sandesha2Constants.MessageTypes.LAST_MESSAGE)
          findSenderBean.setMessageType(Sandesha2Constants.MessageTypes.LAST_MESSAGE);
        else
          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, so 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(rmMsgCtx, replyMessageBean, storageManager, false, null, transaction);
          result = InvocationResponse.ABORT;
          if (log.isDebugEnabled())
            log.debug("Exit: SequenceProcessor::processReliableMessage, replayed message: " + result);
          return result;
        }
      }
     
      EndpointReference acksTo = new EndpointReference (bean.getAcksToEPR());
     
      // Send an Ack if needed.
      //We are not sending acks for duplicate messages in the RM 1.0 anon InOut case.
      //If a standalone ack get sent before the actualy message (I.e. before the original msg get
      //replied), the client may take this as a InOnly message and may avoid looking for the application
      //response.
      if (!(Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmMsgCtx.getRMSpecVersion()) &&
          rmMsgCtx.getReplyTo().hasAnonymousAddress())) {
        sendAckIfNeeded(bean, sequenceId, rmMsgCtx, storageManager, true, acksTo.hasAnonymousAddress())
      }
     
      result = InvocationResponse.ABORT;
      if (log.isDebugEnabled())
        log.debug("Exit: SequenceProcessor::processReliableMessage, dropping duplicate: " + result);
      return result;
    }
   
    // If the message is a reply to an outbound message then we can update the RMSBean that
    // matches.
    EndpointReference toEPR = msgCtx.getTo();
    if(toEPR == null || toEPR.hasAnonymousAddress()) {
      RMSBean outBean = null;

      // Look for the correct outbound sequence by checking the anon uuid (if there is one)
      String toAddress = (toEPR == null) ? null : toEPR.getAddress();
      if(SandeshaUtil.isWSRMAnonymous(toAddress)) {
        RMSBean finderBean = new RMSBean();
        finderBean.setAnonymousUUID(toAddress);
        outBean = storageManager.getRMSBeanMgr().findUnique(finderBean);
      }
     
      // Fall back to the sequence that may have been offered at sequence creation time
      if(outBean == null) {
        String outboundSequence = bean.getOutboundInternalSequence();
        if(outboundSequence != null) {
          outBean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, outboundSequence);
        }
      }
     
      // Update the reply count
      if(outBean != null && outBean.getExpectedReplies() > 0 ) {
        outBean.setExpectedReplies(outBean.getExpectedReplies() - 1);
        RMSBeanMgr outMgr = storageManager.getRMSBeanMgr();
        outMgr.update(outBean);
      }
    }
   
    // Set the last activated time
    bean.setLastActivatedTime(System.currentTimeMillis());
   
    // Update the RMD bean
    mgr.update(bean);
   
    // If we are doing sync 2-way over WSRM 1.0, then we may just have received one of
    // the reply messages that we were looking for. If so we can remove the matching sender bean.
    int mep = msgCtx.getAxisOperation().getAxisSpecificMEPConstant();
    if(specVersion!=null && specVersion.equals(Sandesha2Constants.SPEC_VERSIONS.v1_0) &&
        mep == WSDLConstants.MEP_CONSTANT_OUT_IN) {
      RelatesTo relatesTo = msgCtx.getRelatesTo();
      if(relatesTo != null) {
        String messageId = relatesTo.getValue();
        SenderBean matcher = new SenderBean();
        matcher.setMessageID(messageId);
        SenderBean sender = storageManager.getSenderBeanMgr().findUnique(matcher);
        if(sender != null) {
          if(log.isDebugEnabled()) log.debug("Deleting sender for sync-2-way message");
         
          storageManager.removeMessageContext(sender.getMessageContextRefKey());
         
          //this causes the request to be deleted even without an ack.
          storageManager.getSenderBeanMgr().delete(messageId);
         
          // Try and terminate the corresponding outbound sequence
          RMSBean rmsBean = SandeshaUtil.getRMSBeanFromSequenceId(storageManager, sender.getSequenceID());
          TerminateManager.checkAndTerminate(rmMsgCtx.getConfigurationContext(), storageManager, rmsBean);
        }
      }
    }
View Full Code Here

      rmsBean.setSecurityTokenData(secManager.getTokenRecoveryData(token));
    }
   
    storageManager.getRMSBeanMgr().insert(rmsBean);

    SenderBean createSeqEntry = new SenderBean();
    createSeqEntry.setMessageContextRefKey(createSequenceMessageStoreKey);
    createSeqEntry.setTimeToSend(System.currentTimeMillis());
    createSeqEntry.setMessageID(createSeqRMMessage.getMessageId());
    createSeqEntry.setInternalSequenceID(rmsBean.getInternalSequenceID());
    // this will be set to true in the sender
    createSeqEntry.setSend(true);
    // Indicate that this message is a create sequence
    createSeqEntry.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ);
    EndpointReference to = createSeqRMMessage.getTo();
    if (to!=null)
      createSeqEntry.setToAddress(to.getAddress());
    // If this message is targetted at an anonymous address then we must not have a transport
    // ready for it, as the create sequence is not a reply.
    if(to == null || to.hasAnonymousAddress())
      createSeqEntry.setTransportAvailable(false);

    createSeqMsg.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING, Sandesha2Constants.VALUE_FALSE);
   
    SandeshaUtil.executeAndStore(createSeqRMMessage, createSequenceMessageStoreKey);
View Full Code Here

    // Now that we have decided which sequence to use for the message, make sure that we secure
    // it with the correct token.
    RMMsgCreator.secureOutboundMessage(rmsBean, msg);

    // Retransmitter bean entry for the application message
    SenderBean appMsgEntry = new SenderBean();

    appMsgEntry.setMessageContextRefKey(storageKey);

    appMsgEntry.setTimeToSend(System.currentTimeMillis());
    appMsgEntry.setMessageID(rmMsg.getMessageId());
    appMsgEntry.setMessageNumber(messageNumber);
    appMsgEntry.setLastMessage(lastMessage);
   
    SOAPEnvelope envelope = rmMsg.getSOAPEnvelope();
    if (lastMessage && envelope!=null && envelope.getBody().getFirstOMChild()==null)
      appMsgEntry.setMessageType(Sandesha2Constants.MessageTypes.LAST_MESSAGE);
    else
      appMsgEntry.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
   
    appMsgEntry.setInboundSequenceId(inboundSequence);
    appMsgEntry.setInboundMessageNumber(inboundMessageNumber);
    if (outSequenceID == null) {
      appMsgEntry.setSend(false);
    } else {
      appMsgEntry.setSend(true);
      // Send will be set to true at the sender.
      msg.setProperty(Sandesha2Constants.SET_SEND_TO_TRUE, Sandesha2Constants.VALUE_TRUE);
      appMsgEntry.setSequenceID(outSequenceID);
    }
   
    //If the sequence is in replay mode. We set the reSend to false.
    //In replay mode we cannot do retransmissions unless the request message get duplicated.
    if (rmsBean.isReplayModel())
      appMsgEntry.setReSend(false);
   
    EndpointReference to = rmMsg.getTo();
    if (to!=null)
      appMsgEntry.setToAddress(to.getAddress());
   
    appMsgEntry.setInternalSequenceID(internalSequenceId);

    msg.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING, Sandesha2Constants.VALUE_FALSE);

    // increasing the current handler index, so that the message will not be
    // going throught the SandeshaOutHandler again.
View Full Code Here

      // If we are doing sync 2-way over WSRM 1.0 then we may need to keep sending messages,
      // so check to see if all the senders have been removed
      EndpointReference replyTo = new EndpointReference (replyToAddress);
      if (complete &&
          Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmVersion) && (replyToAddress==null || replyTo.hasAnonymousAddress())) {
        SenderBean matcher = new SenderBean();
        matcher.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
        matcher.setSequenceID(rmsBean.getSequenceID());
       
        List matches = storageManager.getSenderBeanMgr().find(matcher);
        if(!matches.isEmpty()) complete = false;
      }
     
View Full Code Here

      StorageManager storageManager) throws SandeshaException {

    // clean senderMap

    //removing any un-sent ack messages.
    SenderBean findAckBean = new SenderBean ();
    findAckBean.setSequenceID(sequenceId);
    findAckBean.setMessageType(Sandesha2Constants.MessageTypes.ACK);
   
    SenderBeanMgr senderBeanMgr = storageManager.getSenderBeanMgr();
    Iterator ackBeans = senderBeanMgr.find(findAckBean).iterator();
    while (ackBeans.hasNext()) {
      SenderBean ackBean = (SenderBean) ackBeans.next();
      senderBeanMgr.delete(ackBean.getMessageID());
     
      storageManager.removeMessageContext(ackBean.getMessageContextRefKey());
    }
   
    // Currently in-order invocation is done for default values.
    boolean inOrderInvocation = SandeshaUtil.getDefaultPropertyBean(configContext.getAxisConfiguration())
        .isInOrder();
View Full Code Here

    // removing retransmitterMgr entries and corresponding message contexts.
    Collection collection = retransmitterBeanMgr.find(internalSequenceId);
    Iterator iterator = collection.iterator();
    while (iterator.hasNext()) {
      SenderBean retransmitterBean = (SenderBean) iterator.next();
      retransmitterBeanMgr.delete(retransmitterBean.getMessageID());

      String messageStoreKey = retransmitterBean.getMessageContextRefKey();
      storageManager.removeMessageContext(messageStoreKey);
    }
  }
View Full Code Here

    terminateRMMessage.addSOAPEnvelope();

    String key = SandeshaUtil.getUUID();

    SenderBean terminateBean = new SenderBean();
    terminateBean.setInternalSequenceID(internalSequenceID);
    terminateBean.setSequenceID(outSequenceId);
    terminateBean.setMessageContextRefKey(key);
    terminateBean.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);

    // Set a retransmitter lastSentTime so that terminate will be send with
    // some delay.
    // Otherwise this get send before return of the current request (ack).
    // TODO: refine the terminate delay.
    terminateBean.setTimeToSend(System.currentTimeMillis() + Sandesha2Constants.TERMINATE_DELAY);

    terminateBean.setMessageID(terminateRMMessage.getMessageId());

    // this will be set to true at the sender.
    terminateBean.setSend(true);

    terminateRMMessage.getMessageContext().setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING,
        Sandesha2Constants.VALUE_FALSE);

    terminateBean.setReSend(false);
   
    terminateBean.setSequenceID(outSequenceId);
   
    terminateBean.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
    terminateBean.setInternalSequenceID(internalSequenceID);
   
   
    EndpointReference to = terminateRMMessage.getTo();
    if (to!=null)
      terminateBean.setToAddress(to.getAddress());

    // If this message is targetted at an anonymous address then we must not have a transport
    // ready for it, as the terminate sequence is not a reply.
    if(to == null || to.hasAnonymousAddress())
      terminateBean.setTransportAvailable(false);

    rmsBean.setTerminateAdded(true);

    storageManager.getRMSBeanMgr().update(rmsBean);
View Full Code Here

    } else {
      //if RM 1.0 Anonymous scenario we will be trying to attache the TerminateSequence of the response side
      //as the response message.
     
      String outgoingSideInternalSeqId = SandeshaUtil.getOutgoingSideInternalSequenceID(sequenceId);
      SenderBean senderFindBean = new SenderBean ();
      senderFindBean.setInternalSequenceID(outgoingSideInternalSeqId);
      senderFindBean.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
      senderFindBean.setSend(true);
      senderFindBean.setReSend(false);
     
      SenderBean outgoingSideTerminateBean = storageManager.getSenderBeanMgr().findUnique(senderFindBean);
      if (outgoingSideTerminateBean!=null) {
     
        EndpointReference toEPR = new EndpointReference (outgoingSideTerminateBean.getToAddress());
        if (toEPR.hasAnonymousAddress()) {
          String messageKey = outgoingSideTerminateBean
              .getMessageContextRefKey();
          MessageContext message = storageManager
              .retrieveMessageContext(messageKey, context);

          RMMsgContext rmMessage = MsgInitializer.initializeMessage(message);
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.storage.beans.SenderBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.