1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
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 | |
|
15 | |
|
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 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
public int getMaxOutstandingMessages() |
47 | |
{ |
48 | 0 | return maxOutstandingMessages; |
49 | |
} |
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
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 | |
} |