Coverage Report - org.mule.config.QueueProfile
 
Classes in this File Line Coverage Branch Coverage Complexity
QueueProfile
0%
0/22
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.config;
 8  
 
 9  
 import org.mule.api.lifecycle.InitialisationException;
 10  
 import org.mule.util.queue.QueueConfiguration;
 11  
 import org.mule.util.queue.QueueManager;
 12  
 
 13  
 /**
 14  
  * <code>QueueProfile</code> determines how an internal queue for a service will
 15  
  * behave
 16  
  */
 17  
 
 18  
 public class QueueProfile
 19  
 {
 20  0
     private int maxOutstandingMessages = 0;
 21  0
     private boolean persistent = false;
 22  
 
 23  
     public QueueProfile()
 24  
     {
 25  0
         super();
 26  0
     }
 27  
 
 28  
     public QueueProfile(int maxOutstandingMessages, boolean persistent)
 29  0
     {
 30  0
         this.maxOutstandingMessages = maxOutstandingMessages;
 31  0
         this.persistent = persistent;
 32  0
     }
 33  
 
 34  
     public QueueProfile(QueueProfile queueProfile)
 35  0
     {
 36  0
         this.maxOutstandingMessages = queueProfile.getMaxOutstandingMessages();
 37  0
         this.persistent = queueProfile.isPersistent();
 38  0
     }
 39  
 
 40  
     /**
 41  
      * This specifies the number of messages that can be queued before it starts
 42  
      * blocking.
 43  
      * 
 44  
      * @return the max number of messages that will be queued
 45  
      */
 46  
     public int getMaxOutstandingMessages()
 47  
     {
 48  0
         return maxOutstandingMessages;
 49  
     }
 50  
 
 51  
     /**
 52  
      * This specifies the number of messages that can be queued before it starts
 53  
      * blocking.
 54  
      * 
 55  
      * @param maxOutstandingMessages the max number of messages that will be queued
 56  
      */
 57  
     public void setMaxOutstandingMessages(int maxOutstandingMessages)
 58  
     {
 59  0
         this.maxOutstandingMessages = maxOutstandingMessages;
 60  0
     }
 61  
 
 62  
     public boolean isPersistent()
 63  
     {
 64  0
         return persistent;
 65  
     }
 66  
 
 67  
     public void setPersistent(boolean persistent)
 68  
     {
 69  0
         this.persistent = persistent;
 70  0
     }
 71  
 
 72  
     public void configureQueue(String component, QueueManager queueManager) throws InitialisationException
 73  
     {
 74  0
         QueueConfiguration qc = new QueueConfiguration(maxOutstandingMessages, persistent);
 75  0
         queueManager.setQueueConfiguration(component, qc);
 76  0
     }
 77  
 
 78  
     public String toString()
 79  
     {
 80  0
         return "QueueProfile{maxOutstandingMessage=" + maxOutstandingMessages + ", persistent="
 81  
                + persistent + "}";
 82  
     }
 83  
 }