Examples of NextMsgBeanMgr


Examples of org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr

      String offeredSequenceId = offer.getIdentifer().getIdentifier();
      if (offeredSequenceId == null || "".equals(offeredSequenceId)) {
        refuseSequence = true;
        reason = "Offered sequenceId is invalid";
      } else {
        NextMsgBeanMgr nextMsgBeanMgr = storageManager
            .getNextMsgBeanMgr();
        Collection collection = nextMsgBeanMgr.retrieveAll();
        Iterator it = collection.iterator();
        while (it.hasNext()) {

          //checking weather a incoming sequence with the given id
          // exists.
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr

    }

    StorageManager storageManager = SandeshaUtil
        .getSandeshaStorageManager(messageContext.getConfigurationContext());

    NextMsgBeanMgr mgr = storageManager.getNextMsgBeanMgr();
    SOAPEnvelope envelope = messageContext.getEnvelope();

    Collection coll = mgr.retrieveAll();
    Iterator it = coll.iterator();

    boolean validSequence = false;

    while (it.hasNext()) {
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr

    seqPropMgr.insert(receivedMsgBean);
    seqPropMgr.insert(toBean);
    seqPropMgr.insert(replyToBean);
    seqPropMgr.insert(acksToBean);

    NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();
    nextMsgMgr.insert(new NextMsgBean(sequenceId, 1)); // 1 will be the next
    // message to invoke
    //this will apply for only in-order invocations.

    return sequenceId;
  }
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr

      try {

        StorageManager storageManager = SandeshaUtil
            .getSandeshaStorageManager(context);
        NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();

        InvokerBeanMgr storageMapMgr = storageManager
            .getStorageMapBeanMgr();

        SequencePropertyBeanMgr sequencePropMgr = storageManager
            .getSequencePropretyBeanMgr();

        //Getting the incomingSequenceIdList
        SequencePropertyBean sequencePropertyBean = (SequencePropertyBean) sequencePropMgr
            .retrieve(
                Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,
                Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
        if (sequencePropertyBean == null)
          continue;

        ArrayList seqPropList = (ArrayList) sequencePropertyBean
            .getValue();
        Iterator seqPropIt = seqPropList.iterator();

        currentIteration: while (seqPropIt.hasNext()) {

          String sequenceId = (String) seqPropIt.next();

          NextMsgBean nextMsgBean = nextMsgMgr.retrieve(sequenceId);
          if (nextMsgBean == null)
            throw new SandeshaException(
                "Next message not set correctly");

          long nextMsgno = nextMsgBean.getNextMsgNoToProcess();
          if (nextMsgno <= 0)
            throw new SandeshaException(
                "Invalid messaage number for the nextMsgNo");

          Iterator stMapIt = storageMapMgr.find(
              new InvokerBean(null, nextMsgno, sequenceId))
              .iterator();

          while (stMapIt.hasNext()) {

            InvokerBean stMapBean = (InvokerBean) stMapIt
                .next();
            String key = stMapBean.getKey();

            MessageContext msgToInvoke = SandeshaUtil
                .getStoredMessageContext(key);

            RMMsgContext rmMsg = MsgInitializer
                .initializeMessage(msgToInvoke);
            Sequence seq = (Sequence) rmMsg
                .getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
            long msgNo = seq.getMessageNumber().getMessageNumber();

            try {
              //Invoking the message.
              new AxisEngine(msgToInvoke.getConfigurationContext())
                  .receive(msgToInvoke);

              ServiceContext serviceContext = msgToInvoke
                  .getServiceContext();
              Object debug = null;
              if (serviceContext != null) {
                debug = msgToInvoke
                    .getProperty(Sandesha2ClientAPI.SANDESHA_DEBUG_MODE);
                if (debug != null && "on".equals(debug)) {
                  System.out
                      .println("DEBUG: Invoker invoking a '"
                          + SandeshaUtil
                              .getMessageTypeString(rmMsg
                                  .getMessageType())
                          + "' message.");
                }
              }

              //deleting the message entry.
              storageMapMgr.delete(key);

            } catch (AxisFault e) {
              throw new SandeshaException(e.getMessage());
            }

            //undating the next mst to invoke
            nextMsgno++;
            stMapIt = storageMapMgr
                .find(
                    new InvokerBean(null, nextMsgno,
                        sequenceId)).iterator();

            //terminate (AfterInvocation)
            if (rmMsg.getMessageType() == Sandesha2Constants.MessageTypes.APPLICATION) {
              Sequence sequence = (Sequence) rmMsg
                  .getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
              if (sequence.getLastMessage() != null) {
                TerminateManager.terminateAfterInvocation(
                    context, sequenceId);
               
                //exit from current iteration. (since an entry was removed)
                break currentIteration;
              }
            }
          }

          nextMsgBean.setNextMsgNoToProcess(nextMsgno);
          nextMsgMgr.update(nextMsgBean);

        }
      } catch (SandeshaException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.