1 /***
2 *
3 * Copyright 2004 Protique Ltd
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 **/
18
19 package org.codehaus.activemq.message;
20
21 /***
22 * Sent in receipt of a Packet
23 */
24
25 public class Receipt extends AbstractPacket {
26
27 private String correlationId;
28 private String brokerName;
29 private String clusterName;
30 private Throwable exception;
31 private boolean failed;
32 private int brokerMessageCapacity = 100;
33
34
35 /***
36 * @return Returns the jmsException.
37 */
38 public Throwable getException() {
39 return exception;
40 }
41
42 /***
43 * @param exception The exception to set.
44 */
45 public void setException(Throwable exception) {
46 this.exception = exception;
47 }
48
49 /***
50 * Return the type of Packet
51 *
52 * @return integer representation of the type of Packet
53 */
54
55 public int getPacketType() {
56 return RECEIPT_INFO;
57 }
58
59 /***
60 * @return true, this is a receipt packet
61 */
62 public boolean isReceipt() {
63 return true;
64 }
65
66 /***
67 * @return Returns the correlationId.
68 */
69 public String getCorrelationId() {
70 return this.correlationId;
71 }
72
73 /***
74 * @param newCorrelationId The correlationId to set.
75 */
76 public void setCorrelationId(String newCorrelationId) {
77 this.correlationId = newCorrelationId;
78 }
79
80 /***
81 * @return Returns the failed.
82 */
83 public boolean isFailed() {
84 return this.failed;
85 }
86
87 /***
88 * @param newFailed The failed to set.
89 */
90 public void setFailed(boolean newFailed) {
91 this.failed = newFailed;
92 }
93
94 /***
95 * @return pretty print of a Receipt
96 */
97
98 public String toString() {
99 String str = super.toString();
100 str += " correlationId = " + correlationId + " failed = " + failed + " exp = " + exception;
101 str += " , brokerName = " + brokerName;
102 str += " , brokerMessageCapacity = " + brokerMessageCapacity;
103 return str;
104 }
105
106 /***
107 * @return Returns the brokerMessageCapacity.
108 */
109 public int getBrokerMessageCapacity() {
110 return brokerMessageCapacity;
111 }
112 /***
113 * @param brokerMessageCapacity The brokerMessageCapacity to set.
114 */
115 public void setBrokerMessageCapacity(int brokerMessageCapacity) {
116 this.brokerMessageCapacity = brokerMessageCapacity;
117 }
118 /***
119 * @return Returns the brokerName.
120 */
121 public String getBrokerName() {
122 return brokerName;
123 }
124 /***
125 * @param brokerName The brokerName to set.
126 */
127 public void setBrokerName(String brokerName) {
128 this.brokerName = brokerName;
129 }
130 /***
131 * @return Returns the clusterName.
132 */
133 public String getClusterName() {
134 return clusterName;
135 }
136 /***
137 * @param clusterName The clusterName to set.
138 */
139 public void setClusterName(String clusterName) {
140 this.clusterName = clusterName;
141 }
142 }