Package org.wijiscommons.ssaf.queue

Examples of org.wijiscommons.ssaf.queue.Queue


  public void startProcessing()
  {
    QueueMessage msg = messageQueue.readHeadMessage();
        if (msg != null) {
          try {
              Queue stashq = QueueService.getQueue(provider.getStashQueueName(folderName));
            stashq.enqueue(msg);
            for (int i = 0; i < workflowNames.size(); i++) {
                String workflowName = workflowNames.get(i);
                Queue workflowq = QueueService.getQueue(provider.getWorkflowQueueName(folderName, workflowName));
                workflowq.enqueue(msg);
              }
                messageQueue.removeHeadMessage(msg);
          }
          catch (QueueException qe)
          {
View Full Code Here


          // TODO Call Work flow Execution here.
          try
          {
            SSAFWorkflowProcess workflowProcess = new WorkflowProcessImpl();
            String finalXML = workflowProcess.applyWorkflow((String)msg.getObject(),this.folderName, this.workflowName);
            Queue outboundq = QueueService.getQueue(provider.getOutBoundQueueName(folderName, workflowName));
            msg.setObject(finalXML);
              outboundq.enqueue(msg);
                messageQueue.removeHeadMessage(msg);
          }
          catch (QueueException qe)
          {
           
View Full Code Here

        }
        synchronized (queues) {
            if (queues.containsKey(queueName)) {
                return queues.get(queueName);
            } else {
                Queue newQueue = new QueueImpl(queueName);
                queues.put(queueName, newQueue);
                return newQueue;
            }
        }
    }
View Full Code Here

        if (queueName == null) {
            throw new NullPointerException("The name of the queue cannot be 'null'");
        }
        synchronized (queues) {
            if (queues.containsKey(queueName)) {
                Queue queue = queues.get(queueName);
                QueueImpl mqi = (QueueImpl) queue;
                mqi.deleteQueue();
                queues.remove(queueName);
                return true;
            } else {
View Full Code Here

    public static void shutDownQueues() {
        synchronized (queues) {
          Collection<Queue> sQ = queues.values();
          for (Iterator<Queue> qIter = sQ.iterator(); qIter.hasNext();)
          {
            Queue queue = qIter.next();
            queue.shutdown();
          }
        }
    }
View Full Code Here

  public boolean receiveMessage(Message message) throws DropoffMailBoxException
  {
   
    boolean isMessageInsertedWithoutError = false;
    QueueMessage queueMessage = new QueueMessageImpl();
    Queue queue = null;
    DropoffMailBoxException de = null;
    String messageID = message.getMessageID();
    try {
     
      queue = QueueService.getQueue(provider.getInboundQueueName(message.getFolderSource()));
      queueMessage.setObject(message.getIncomingMessageXML());
      queueMessage.setMessageID(messageID);
      queueMessage.setBody("Inserting processed message with id "+message.getMessageID()+ " from folder "+message.getFolderSource() );
      queueMessage.setErrorMessage(false);
      isMessageInsertedWithoutError = true;
      getProcessesExecuted(message);

    }
    catch (SSAFAuthenticationException authentication)
    {
      queueMessage.setBody("Error message with id "+message.getMessageID()+ " from folder "+message.getFolderSource() );
      queueMessage.setErrorMessage(true);
      isMessageInsertedWithoutError = false;
      de = new DropoffMailBoxException();
      de.setMessageID(messageID);
      de.initCause(authentication);
    }
    catch (SSAFAuthorizationException authorization)
    {
      queueMessage.setBody("Error message with id "+message.getMessageID()+ " from folder "+message.getFolderSource() );
      queueMessage.setErrorMessage(true);
      isMessageInsertedWithoutError = false;
      de = new DropoffMailBoxException();
      de.setMessageID(messageID);
      de.initCause(authorization);
    }
    catch (SSAFValidationException validation)
    {
      queueMessage.setBody("Error message with id "+message.getMessageID()+ " from folder "+message.getFolderSource() );
      queueMessage.setErrorMessage(true);
      isMessageInsertedWithoutError = false;
      de = new DropoffMailBoxException();
      de.setMessageID(messageID);
      de.initCause(validation);
    }
    catch (Exception exception)
    {
      queueMessage.setBody("Error message with id "+message.getMessageID()+ " from folder "+message.getFolderSource() );
      queueMessage.setErrorMessage(true);
      isMessageInsertedWithoutError = false;
      de = new DropoffMailBoxException();
      de.setMessageID(messageID);
      de.initCause(exception);
    }
    finally
    {
     
      try
      {
        // Step 5: Store Object into Queue
        queue.enqueue(queueMessage);
        if (!isMessageInsertedWithoutError)
        {
          throw de;
        }
      }
View Full Code Here

TOP

Related Classes of org.wijiscommons.ssaf.queue.Queue

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.