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 Throwable exception;
29 private boolean failed;
30 private int brokerMessageCapacity = 100;
31
32
33 /***
34 * @return Returns the jmsException.
35 */
36 public Throwable getException() {
37 return exception;
38 }
39
40 /***
41 * @param exception The exception to set.
42 */
43 public void setException(Throwable exception) {
44 this.exception = exception;
45 }
46
47 /***
48 * Return the type of Packet
49 *
50 * @return integer representation of the type of Packet
51 */
52
53 public int getPacketType() {
54 return RECEIPT_INFO;
55 }
56
57 /***
58 * @return true, this is a receipt packet
59 */
60 public boolean isReceipt() {
61 return true;
62 }
63
64 /***
65 * @return Returns the correlationId.
66 */
67 public String getCorrelationId() {
68 return this.correlationId;
69 }
70
71 /***
72 * @param newCorrelationId The correlationId to set.
73 */
74 public void setCorrelationId(String newCorrelationId) {
75 this.correlationId = newCorrelationId;
76 }
77
78 /***
79 * @return Returns the failed.
80 */
81 public boolean isFailed() {
82 return this.failed;
83 }
84
85 /***
86 * @param newFailed The failed to set.
87 */
88 public void setFailed(boolean newFailed) {
89 this.failed = newFailed;
90 }
91
92 /***
93 * @return pretty print of a Receipt
94 */
95
96 public String toString() {
97 String str = super.toString();
98 str += " correlationId = " + correlationId + " failed = " + failed + " exp = " + exception;
99 str += " , brokerMessageCapacity = " + brokerMessageCapacity;
100 return str;
101 }
102
103 /***
104 * @return Returns the brokerMessageCapacity.
105 */
106 public int getBrokerMessageCapacity() {
107 return brokerMessageCapacity;
108 }
109 /***
110 * @param brokerMessageCapacity The brokerMessageCapacity to set.
111 */
112 public void setBrokerMessageCapacity(int brokerMessageCapacity) {
113 this.brokerMessageCapacity = brokerMessageCapacity;
114 }
115 }