1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.config; |
12 | |
|
13 | |
import org.mule.api.lifecycle.InitialisationException; |
14 | |
import org.mule.util.queue.QueueConfiguration; |
15 | |
import org.mule.util.queue.QueueManager; |
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
public class QueueProfile |
23 | |
{ |
24 | 1540 | private int maxOutstandingMessages = 0; |
25 | 1540 | private boolean persistent = false; |
26 | |
|
27 | |
public QueueProfile() |
28 | |
{ |
29 | 1540 | super(); |
30 | 1540 | } |
31 | |
|
32 | |
public QueueProfile(int maxOutstandingMessages, boolean persistent) |
33 | 0 | { |
34 | 0 | this.maxOutstandingMessages = maxOutstandingMessages; |
35 | 0 | this.persistent = persistent; |
36 | 0 | } |
37 | |
|
38 | |
public QueueProfile(QueueProfile queueProfile) |
39 | 0 | { |
40 | 0 | this.maxOutstandingMessages = queueProfile.getMaxOutstandingMessages(); |
41 | 0 | this.persistent = queueProfile.isPersistent(); |
42 | 0 | } |
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
public int getMaxOutstandingMessages() |
51 | |
{ |
52 | 0 | return maxOutstandingMessages; |
53 | |
} |
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
public void setMaxOutstandingMessages(int maxOutstandingMessages) |
62 | |
{ |
63 | 0 | this.maxOutstandingMessages = maxOutstandingMessages; |
64 | 0 | } |
65 | |
|
66 | |
public boolean isPersistent() |
67 | |
{ |
68 | 0 | return persistent; |
69 | |
} |
70 | |
|
71 | |
public void setPersistent(boolean persistent) |
72 | |
{ |
73 | 0 | this.persistent = persistent; |
74 | 0 | } |
75 | |
|
76 | |
public void configureQueue(String component, QueueManager queueManager) throws InitialisationException |
77 | |
{ |
78 | 390 | QueueConfiguration qc = new QueueConfiguration(maxOutstandingMessages, persistent); |
79 | 390 | queueManager.setQueueConfiguration(component, qc); |
80 | 390 | } |
81 | |
|
82 | |
public String toString() |
83 | |
{ |
84 | 0 | return "QueueProfile{maxOutstandingMessage=" + maxOutstandingMessages + ", persistent=" |
85 | |
+ persistent + "}"; |
86 | |
} |
87 | |
} |