View Javadoc

1   /*
2    * $Id: SedaModel.java 22175 2011-06-14 13:54:58Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.model.seda;
12  
13  import org.mule.api.lifecycle.InitialisationException;
14  import org.mule.config.PoolingProfile;
15  import org.mule.config.QueueProfile;
16  import org.mule.model.AbstractModel;
17  
18  /**
19   * A mule service service model that uses SEDA principals to achieve high
20   * throughput by Queuing events for components and processing them concurrently.
21   */
22  public class SedaModel extends AbstractModel
23  {
24      /**
25       * The time out used for taking from the Seda Queue.
26       */
27      private Integer queueTimeout;
28  
29      /**
30       * the pooling configuration used when initialising the service described by
31       * this descriptor.
32       */
33      protected PoolingProfile poolingProfile;
34  
35      /**
36       * The queuing profile for events received for this service
37       */
38      protected QueueProfile queueProfile;
39  
40      /**
41       * Returns the model type name. This is a friendly identifier that is used to
42       * look up the SPI class for the model
43       * 
44       * @return the model type
45       */
46      @Override
47      public String getType()
48      {
49          return "seda";
50      }
51  
52      @Override
53      public void initialise() throws InitialisationException
54      {
55          if (queueTimeout == null)
56          {
57              queueTimeout = muleContext.getConfiguration().getDefaultQueueTimeout();
58          }
59          if (queueProfile == null)
60          {
61              queueProfile = QueueProfile.newInstancePersistingToDefaultMemoryQueueStore(muleContext);
62          }
63          if (poolingProfile == null)
64          {
65              poolingProfile = new PoolingProfile();
66          }
67          super.initialise();
68      }
69  
70      public int getQueueTimeout()
71      {
72          return queueTimeout;
73      }
74  
75      public void setQueueTimeout(int queueTimeout)
76      {
77          this.queueTimeout = queueTimeout;
78      }
79  
80      public PoolingProfile getPoolingProfile()
81      {
82          return poolingProfile;
83      }
84  
85      public void setPoolingProfile(PoolingProfile poolingProfile)
86      {
87          this.poolingProfile = poolingProfile;
88      }
89  
90      public QueueProfile getQueueProfile()
91      {
92          return queueProfile;
93      }
94  
95      public void setQueueProfile(QueueProfile queueProfile)
96      {
97          this.queueProfile = queueProfile;
98      }
99  }