KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > command > ProducerAck


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.command;
19
20 import org.apache.activemq.state.CommandVisitor;
21
22
23 /**
24  * A ProducerAck command is sent by a broker to a producer to let it know it has received and processed
25  * messages that it has produced. The producer will be flow controlled if it does not receive
26  * ProducerAck commands back from the broker.
27  *
28  * @openwire:marshaller code="19" version="3"
29  * @version $Revision: 1.11 $
30  */

31 public class ProducerAck extends BaseCommand {
32
33     public static final byte DATA_STRUCTURE_TYPE=CommandTypes.PRODUCER_ACK;
34     
35     protected ProducerId producerId;
36     protected int size;
37     
38     public ProducerAck() {
39     }
40     
41     public ProducerAck(ProducerId producerId, int size) {
42         this.producerId = producerId;
43         this.size = size;
44     }
45     
46     public void copy(ProducerAck copy) {
47         super.copy(copy);
48         copy.producerId = producerId;
49         copy.size = size;
50     }
51
52     public byte getDataStructureType() {
53         return DATA_STRUCTURE_TYPE;
54     }
55     
56     public Response visit(CommandVisitor visitor) throws Exception JavaDoc {
57         return visitor.processProducerAck( this );
58     }
59
60     /**
61      * The producer id that this ack message is destined for.
62      *
63      * @openwire:property version=3
64      */

65     public ProducerId getProducerId() {
66         return producerId;
67     }
68
69     public void setProducerId(ProducerId producerId) {
70         this.producerId = producerId;
71     }
72
73     /**
74      * The number of bytes that are being acked.
75      *
76      * @openwire:property version=3
77      */

78     public int getSize() {
79         return size;
80     }
81
82     public void setSize(int size) {
83         this.size = size;
84     }
85
86
87 }
88
Popular Tags