Examples of NextMsgBean


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

    public void tearDown() throws Exception {
      transaction.commit();
    }

    public void testDelete() throws SandeshaStorageException{
        mgr.insert(new NextMsgBean("SeqId1", 1001));
        mgr.delete("SeqId1");
        assertNull(mgr.retrieve("SeqId1"));
    }
View Full Code Here

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

        mgr.delete("SeqId1");
        assertNull(mgr.retrieve("SeqId1"));
    }

    public void testFind() throws SandeshaStorageException {
        mgr.insert(new NextMsgBean("SeqId2", 1002));
        mgr.insert(new NextMsgBean("SeqId3", 1002));

        NextMsgBean target = new NextMsgBean();
        target.setNextMsgNoToProcess(1002);

        Iterator iterator = mgr.find(target).iterator();
        NextMsgBean tmp = (NextMsgBean) iterator.next();

        if (tmp.getSequenceID().equals("SeqId2")) {
            tmp = (NextMsgBean) iterator.next();
            tmp.getSequenceID().equals("SeqId3");
        } else {
            tmp = (NextMsgBean) iterator.next();
            tmp.getSequenceID().equals("SeqId2");
        }

    }
View Full Code Here

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

        }

    }

    public void testInsert() throws SandeshaStorageException {
        NextMsgBean bean = new NextMsgBean("SeqId4", 1004);
        mgr.insert(bean);
        NextMsgBean tmp = mgr.retrieve("SeqId4");
        assertTrue(tmp.getNextMsgNoToProcess() == 1004);
    }
View Full Code Here

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

        assertTrue(tmp.getNextMsgNoToProcess() == 1004);
    }

    public void testRetrieve() throws SandeshaStorageException {
        assertNull(mgr.retrieve("SeqId5"));
        mgr.insert(new NextMsgBean("SeqId5", 1005));

        NextMsgBean tmp = mgr.retrieve("SeqId5");
        assertTrue(tmp.getNextMsgNoToProcess() == 1005);
    }
View Full Code Here

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

        NextMsgBean tmp = mgr.retrieve("SeqId5");
        assertTrue(tmp.getNextMsgNoToProcess() == 1005);
    }

    public void testUpdate() throws SandeshaStorageException {
        NextMsgBean bean = new NextMsgBean("SeqId6", 1006);
        mgr.insert(bean);
        bean.setNextMsgNoToProcess(1007);
        mgr.update(bean);
        NextMsgBean tmp = mgr.retrieve("SeqId6");
        assertTrue(tmp.getNextMsgNoToProcess() ==1007);
    }
View Full Code Here

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

    Iterator iterator = table.values().iterator();

    if (bean == null)
      return beans;

    NextMsgBean temp;
    while (iterator.hasNext()) {
      temp = (NextMsgBean) iterator.next();

      boolean equal = true;

      if (bean.getNextMsgNoToProcess() > 0
          && bean.getNextMsgNoToProcess() != temp
              .getNextMsgNoToProcess())
        equal = false;

      if (bean.getSequenceID() != null
          && !bean.getSequenceID().equals(temp.getSequenceID()))
        equal = false;

      if (equal)
        beans.add(temp);
View Full Code Here

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

          String sequenceId = (String) allSequencesItr.next();
         
          Transaction invocationTransaction = storageManager.getTransaction();   //Transaction based invocation
         
          NextMsgBean nextMsgBean = nextMsgMgr.retrieve(sequenceId);
          if (nextMsgBean == null) {

            String message = "Next message not set correctly. Removing invalid entry.";
            log.debug(message);
            allSequencesItr.remove();
           
            //cleaning the invalid data of the all sequences.
            allSequencesBean.setValue(allSequencesList.toString());
            sequencePropMgr.update(allSequencesBean)
           
            throw new SandeshaException (message);
          }

          long nextMsgno = nextMsgBean.getNextMsgNoToProcess();
          if (nextMsgno <= 0) {
            String message = "Invalid messaage number as the Next Message Number. Removing invalid entry";
           
            throw new SandeshaException(message);
          }

          Iterator stMapIt = storageMapMgr.find(
              new InvokerBean(null, nextMsgno, sequenceId))
              .iterator();
         
          boolean invoked = false;
         
          while (stMapIt.hasNext()) {

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


            MessageContext msgToInvoke = storageManager.retrieveMessageContext(key,context);

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

            long msgNo = seq.getMessageNumber().getMessageNumber();

            try {
              //Invoking the message.

              //currently Transaction based invocation can be supplied only for the in-only case.
             
              if (!AxisOperationFactory.MEP_URI_IN_ONLY.equals(msgToInvoke.getAxisOperation().getMessageExchangePattern())) {
                invocationTransaction.commit();
              }
             
              new AxisEngine (msgToInvoke.getConfigurationContext())
                  .resume(msgToInvoke);
              invoked = true;
             
              if (!AxisOperationFactory.MEP_URI_IN_ONLY.equals(msgToInvoke.getAxisOperation().getMessageExchangePattern())) {
                invocationTransaction = storageManager.getTransaction();
              }           

              storageMapMgr.delete(key);
            } catch (AxisFault e) {
              throw new SandeshaException(e);
            }

            //undating the next msg to invoke


            if (rmMsg.getMessageType() == Sandesha2Constants.MessageTypes.APPLICATION) {
              Sequence sequence = (Sequence) rmMsg
                  .getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
              if (sequence.getLastMessage() != null) {
               
                TerminateManager.cleanReceivingSideAfterInvocation(context, sequenceId);
               
                //this sequence has no more invocations
//                stopInvokerForTheSequence(sequenceId);
               
                //exit from current iteration. (since an entry was removed)
                invocationTransaction.commit();
                break currentIteration;
              }
            }
          }

          if (invoked) {
            nextMsgno++;
            nextMsgBean.setNextMsgNoToProcess(nextMsgno);
            nextMsgMgr.update(nextMsgBean);
            invocationTransaction.commit();
          }
        }
       
View Full Code Here

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

    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
    InvokerBeanMgr storageMapBeanMgr = storageManager.getStorageMapBeanMgr();
    NextMsgBeanMgr nextMsgBeanMgr = storageManager.getNextMsgBeanMgr();
   
    //removing nextMsgMgr entries
    NextMsgBean findNextMsgBean = new NextMsgBean ();
    findNextMsgBean.setSequenceID(sequenceID);
    Collection collection = nextMsgBeanMgr.find(findNextMsgBean);
    Iterator iterator = collection.iterator();
    while (iterator.hasNext()) {
      NextMsgBean nextMsgBean = (NextMsgBean) iterator.next();
      //nextMsgBeanMgr.delete(nextMsgBean.getSequenceID());
    }
   
    removeReceivingSideProperties(configContext,sequenceID);
  }
View Full Code Here

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

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

      boolean contains = false;
      while (it.hasNext()) {
        NextMsgBean nextMsgBean = (NextMsgBean) it.next();
        String tempId = nextMsgBean.getSequenceID();
        if (tempId.equals(sequenceID)) {
          contains = true;
          break;
        }
      }
View Full Code Here

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

    Transaction invokeTransaction = storageManager.getTransaction();

    //  Pause the messages bean if not the right message to invoke.
    NextMsgBeanMgr mgr = storageManager.getNextMsgBeanMgr();
    NextMsgBean bean = mgr.retrieve(sequenceId);

    if (bean == null)
      throw new SandeshaException("Error- The sequence does not exist");

    InvokerBeanMgr storageMapMgr = storageManager.getStorageMapBeanMgr();
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.