KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Used to pull messages on demand.
24  *
25  * @openwire:marshaller code="20"
26  *
27  * @version $Revision: 516040 $
28  */

29 public class MessagePull extends BaseCommand {
30
31     public static final byte DATA_STRUCTURE_TYPE = CommandTypes.MESSAGE_PULL;
32
33     protected ConsumerId consumerId;
34     protected ActiveMQDestination destination;
35     protected long timeout;
36     private MessageId messageId;
37     private String JavaDoc correlationId;
38
39     public byte getDataStructureType() {
40         return DATA_STRUCTURE_TYPE;
41     }
42
43     public Response visit(CommandVisitor visitor) throws Exception JavaDoc {
44         return visitor.processMessagePull(this);
45     }
46
47     /**
48      * Configures a message pull from the consumer information
49      */

50     public void configure(ConsumerInfo info) {
51         setConsumerId(info.getConsumerId());
52         setDestination(info.getDestination());
53     }
54
55     /**
56      * @openwire:property version=1 cache=true
57      */

58     public ConsumerId getConsumerId() {
59         return consumerId;
60     }
61
62     public void setConsumerId(ConsumerId consumerId) {
63         this.consumerId = consumerId;
64     }
65
66     /**
67      * @openwire:property version=1 cache=true
68      */

69     public ActiveMQDestination getDestination() {
70         return destination;
71     }
72
73     public void setDestination(ActiveMQDestination destination) {
74         this.destination = destination;
75     }
76
77     /**
78      * @openwire:property version=1
79      */

80     public long getTimeout() {
81         return timeout;
82     }
83
84     public void setTimeout(long timeout) {
85         this.timeout = timeout;
86     }
87
88     /**
89      * An optional correlation ID which could be used by a broker to decide which messages are pulled
90      * on demand from a queue for a consumer
91      *
92      * @openwire:property version=3
93      */

94     public String JavaDoc getCorrelationId() {
95         return correlationId;
96     }
97
98     public void setCorrelationId(String JavaDoc correlationId) {
99         this.correlationId = correlationId;
100     }
101
102
103     /**
104      * An optional message ID which could be used by a broker to decide which messages are pulled
105      * on demand from a queue for a consumer
106      *
107      * @openwire:property version=3
108      */

109     public MessageId getMessageId() {
110         return messageId;
111     }
112
113     public void setMessageId(MessageId messageId) {
114         this.messageId = messageId;
115     }
116 }
117
Popular Tags