View Javadoc
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.model.seda;
8   
9   import org.mule.api.lifecycle.InitialisationException;
10  import org.mule.config.PoolingProfile;
11  import org.mule.config.QueueProfile;
12  import org.mule.model.AbstractModel;
13  
14  /**
15   * A mule service service model that uses SEDA principals to achieve high
16   * throughput by Queuing events for components and processing them concurrently.
17   */
18  public class SedaModel extends AbstractModel
19  {
20      /**
21       * The time out used for taking from the Seda Queue.
22       */
23      private Integer queueTimeout;
24  
25      /**
26       * the pooling configuration used when initialising the service described by
27       * this descriptor.
28       */
29      protected PoolingProfile poolingProfile;
30  
31      /**
32       * The queuing profile for events received for this service
33       */
34      protected QueueProfile queueProfile;
35  
36      /**
37       * Returns the model type name. This is a friendly identifier that is used to
38       * look up the SPI class for the model
39       * 
40       * @return the model type
41       */
42      public String getType()
43      {
44          return "seda";
45      }
46  
47      public void initialise() throws InitialisationException
48      {
49          if (queueTimeout == null)
50          {
51              queueTimeout = muleContext.getConfiguration().getDefaultQueueTimeout();
52          }
53          if (queueProfile == null)
54          {
55              queueProfile = new QueueProfile();
56          }
57          if (poolingProfile == null)
58          {
59              poolingProfile = new PoolingProfile();
60          }
61          super.initialise();
62      }
63  
64      public int getQueueTimeout()
65      {
66          return queueTimeout;
67      }
68  
69      public void setQueueTimeout(int queueTimeout)
70      {
71          this.queueTimeout = queueTimeout;
72      }
73  
74      public PoolingProfile getPoolingProfile()
75      {
76          return poolingProfile;
77      }
78  
79      public void setPoolingProfile(PoolingProfile poolingProfile)
80      {
81          this.poolingProfile = poolingProfile;
82      }
83  
84      public QueueProfile getQueueProfile()
85      {
86          return queueProfile;
87      }
88  
89      public void setQueueProfile(QueueProfile queueProfile)
90      {
91          this.queueProfile = queueProfile;
92      }
93  }