KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > broker > region > Region


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.broker.region;
19
20 import org.apache.activemq.Service;
21 import org.apache.activemq.broker.ConnectionContext;
22 import org.apache.activemq.broker.ConsumerBrokerExchange;
23 import org.apache.activemq.broker.ProducerBrokerExchange;
24 import org.apache.activemq.command.ActiveMQDestination;
25 import org.apache.activemq.command.ConsumerInfo;
26 import org.apache.activemq.command.Message;
27 import org.apache.activemq.command.MessageAck;
28 import org.apache.activemq.command.MessageDispatchNotification;
29 import org.apache.activemq.command.MessagePull;
30 import org.apache.activemq.command.RemoveSubscriptionInfo;
31 import org.apache.activemq.command.Response;
32
33 import java.util.Map JavaDoc;
34 import java.util.Set JavaDoc;
35
36 /**
37  * A Region is used to implement the different QOS options available to
38  * a broker. A Broker is composed of multiple message processing Regions that
39  * provide different QOS options.
40  *
41  * @version $Revision$
42  */

43 public interface Region extends Service {
44
45     /**
46      * Used to create a destination. Usually, this method is invoked as a side-effect of sending
47      * a message to a destination that does not exist yet.
48      *
49      * @param context
50      * @param destination the destination to create.
51      * @return TODO
52      * @throws Exception TODO
53      */

54     public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception JavaDoc;
55     
56     /**
57      * Used to destroy a destination.
58      * This should try to quiesce use of the destination up to the timeout allotted time before removing the destination.
59      * This will remove all persistent messages associated with the destination.
60      *
61      * @param context the environment the operation is being executed under.
62      * @param destination what is being removed from the broker.
63      * @param timeout the max amount of time to wait for the destination to quiesce
64      * @throws Exception TODO
65      */

66     public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception JavaDoc;
67
68     /**
69      * Returns a copy of the current destinations available in the region
70      *
71      * @return a copy of the regions currently active at the time of the call with the key the destination and the value the Destination.
72      */

73     public Map JavaDoc getDestinationMap();
74     
75
76     /**
77      * Adds a consumer.
78      * @param context the environment the operation is being executed under.
79      * @return TODO
80      * @throws Exception TODO
81      */

82     public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception JavaDoc;
83
84     /**
85      * Removes a consumer.
86      * @param context the environment the operation is being executed under.
87      * @throws Exception TODO
88      */

89     public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception JavaDoc;
90
91     /**
92      * Deletes a durable subscription.
93      * @param context the environment the operation is being executed under.
94      * @param info TODO
95      * @throws Exception TODO
96      */

97     public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception JavaDoc;
98     
99     /**
100      * Send a message to the broker to using the specified destination. The destination specified
101      * in the message does not need to match the destination the message is sent to. This is
102      * handy in case the message is being sent to a dead letter destination.
103      * @param producerExchange the environment the operation is being executed under.
104      * @param message
105      * @throws Exception TODO
106      */

107     public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception JavaDoc;
108     
109     /**
110      * Used to acknowledge the receipt of a message by a client.
111      * @param consumerExchange the environment the operation is being executed under.
112      * @throws Exception TODO
113      */

114     public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception JavaDoc;
115     
116     /**
117      * Allows a consumer to pull a message from a queue
118      */

119     public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception JavaDoc;
120
121     /**
122      * Process a notification of a dispatch - used by a Slave Broker
123      * @param messageDispatchNotification
124      * @throws Exception TODO
125      */

126     public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception JavaDoc;
127
128     public void gc();
129
130     /**
131      * Provide an exact or wildcard lookup of destinations in the region
132      *
133      * @return a set of matching destination objects.
134      */

135     public Set JavaDoc getDestinations(ActiveMQDestination destination);
136     
137 }
138
Popular Tags