Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/broker/Broker.java


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  package org.activemq.broker;
19  
20  import org.activemq.capacity.CapacityMonitor;
21  import org.activemq.message.ActiveMQMessage;
22  import org.activemq.message.ActiveMQXid;
23  import org.activemq.message.BrokerInfo;
24  import org.activemq.message.ConnectionInfo;
25  import org.activemq.message.ConsumerInfo;
26  import org.activemq.message.MessageAck;
27  import org.activemq.message.ProducerInfo;
28  import org.activemq.security.SecurityAdapter;
29  import org.activemq.service.DeadLetterPolicy;
30  import org.activemq.service.MessageContainerManager;
31  import org.activemq.service.RedeliveryPolicy;
32  import org.activemq.service.Service;
33  import org.activemq.store.PersistenceAdapter;
34  
35  import javax.jms.JMSException;
36  import javax.naming.Context;
37  import javax.transaction.xa.XAException;
38  import java.io.File;
39  import java.util.Hashtable;
40  import java.util.Map;
41  
42  /**
43   * The Message Broker which routes messages,
44   * maintains subscriptions and connections, acknowlegdges messages and handles
45   * transactions.
46   *
47   * @version $Revision: 1.1.1.1 $
48   */
49  public interface Broker extends Service, CapacityMonitor {
50      
51      /**
52       * Get's the admin interface of the broker.
53       * 
54       * @return the admin interface of the broker.
55       */
56      public BrokerAdmin getBrokerAdmin();
57      
58      public BrokerInfo getBrokerInfo();
59  
60      /**
61       * Notification of a new client attempting to connect, which can
62       * be rejected if authentication or authorization fails.
63       */
64      public void addClient(BrokerClient client, ConnectionInfo info) throws JMSException;
65  
66      /**
67       * A hint to the broker that an BrokerClient has stopped
68       * This enables the broker to clean-up any outstanding processing
69       * that may be outstanding
70       */
71      public void removeClient(BrokerClient client, ConnectionInfo info) throws JMSException;
72  
73      /**
74       * Adds a new message producer, which could be rejected due to authorization
75       */
76      public void addMessageProducer(BrokerClient client, ProducerInfo info) throws JMSException;
77  
78      /**
79       * Removes a producer
80       */
81      public void removeMessageProducer(BrokerClient client, ProducerInfo info) throws JMSException;
82  
83  
84      /**
85       * Add an active message consumer, which could be rejected due to authorization
86       */
87      public void addMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException;
88  
89      /**
90       * remove an active message consumer
91       */
92      public void removeMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException;
93  
94  
95      /**
96       * send a message to the broker
97       */
98      public void sendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException;
99  
100     /**
101      * Acknowledge positively or negatively, the consumption of a message by the Message Consumer
102      */
103     public void acknowledgeMessage(BrokerClient client, MessageAck ack) throws JMSException;
104 
105     /**
106      * gets a list of all the prepared xa transactions.
107      *
108      * @param client
109      */
110     public ActiveMQXid[] getPreparedTransactions(BrokerClient client) throws XAException;
111 
112     /**
113      * Delete a durable subscriber
114      *
115      * @param clientId
116      * @param subscriberName
117      * @throws JMSException if the subscriber doesn't exist or is still active
118      */
119     public void deleteSubscription(String clientId, String subscriberName) throws JMSException;
120 
121     /**
122      * start a transaction
123      *
124      * @param client
125      * @param transactionId
126      */
127     public void startTransaction(BrokerClient client, String transactionId) throws JMSException;
128 
129     /**
130      * commit a transaction
131      *
132      * @param client
133      * @param transactionId
134      * @throws JMSException
135      */
136     public void commitTransaction(BrokerClient client, String transactionId) throws JMSException;
137 
138     /**
139      * rollback a transaction
140      *
141      * @param client
142      * @param transactionId
143      * @throws JMSException
144      */
145     public void rollbackTransaction(BrokerClient client, String transactionId) throws JMSException;
146 
147 
148     /**
149      * @param client
150      * @param xid
151      * @throws XAException
152      */
153     public void startTransaction(BrokerClient client, ActiveMQXid xid) throws XAException;
154 
155     /**
156      * @param client
157      * @param xid
158      * @return
159      * @throws XAException
160      */
161     public int prepareTransaction(BrokerClient client, ActiveMQXid xid) throws XAException;
162 
163     /**
164      * @param client
165      * @param xid
166      * @throws XAException
167      */
168 
169     public void rollbackTransaction(BrokerClient client, ActiveMQXid xid) throws XAException;
170 
171     /**
172      * @param client
173      * @param xid
174      * @param onePhase
175      * @throws XAException
176      */
177     public void commitTransaction(BrokerClient client, ActiveMQXid xid, boolean onePhase) throws XAException;
178     
179 
180     // Properties
181     //-------------------------------------------------------------------------
182 
183     /**
184      * Get a temp directory - used for spooling
185      *
186      * @return a File ptr to the directory
187      */
188     public File getTempDir();
189 
190     /**
191      * @return the name of the Broker
192      */
193     public String getBrokerName();
194     
195     /**
196      * @return the name of the cluster the broker belongs to
197      */
198     public String getBrokerClusterName();
199 
200     /**
201      * @return the PersistenceAdaptor
202      */
203     public PersistenceAdapter getPersistenceAdapter();
204 
205     /**
206      * set the persistence adaptor
207      *
208      * @param persistenceAdapter
209      */
210     public void setPersistenceAdapter(PersistenceAdapter persistenceAdapter);
211 
212     /**
213      * @return a map, indexed by name of the container managers
214      */
215     public Map getContainerManagerMap();
216 
217     /**
218      * Returns the naming context of the destinations available in this broker
219      *
220      * @param environment
221      * @return the context
222      */
223     public Context getDestinationContext(Hashtable environment);
224 
225     /**
226      * Add a ConsumerInfoListener to the Broker
227      *
228      * @param l
229      */
230     public void addConsumerInfoListener(ConsumerInfoListener l);
231 
232     /**
233      * Remove a ConsumerInfoListener from the Broker
234      *
235      * @param l
236      */
237     public void removeConsumerInfoListener(ConsumerInfoListener l);
238 
239 
240     /**
241      * @return the MessageContainerManager for durable topics
242      */
243     public MessageContainerManager getPersistentTopicContainerManager();
244 
245     /**
246      * @return the MessageContainerManager for transient topics
247      */
248     public MessageContainerManager getTransientTopicContainerManager();
249 
250     /**
251      * @return the MessageContainerManager for persistent queues
252      */
253     public MessageContainerManager getPersistentQueueContainerManager();
254 
255     /**
256      * @return the MessageContainerManager for transient queues
257      */
258     public MessageContainerManager getTransientQueueContainerManager();
259 
260     /**
261      * Returns the security adapter used to authenticate and authorize access to JMS resources
262      */
263     public SecurityAdapter getSecurityAdapter();
264 
265     /**
266      * Sets the security adapter used to authenticate and authorize access to JMS resources
267      */
268     public void setSecurityAdapter(SecurityAdapter securityAdapter);
269 
270     /**
271      * @return the RedeliveryPolicy
272      */
273     RedeliveryPolicy getRedeliveryPolicy();
274 
275     /**
276      * set the redelivery policy
277      * @param redeliveryPolicy
278      */
279     void setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy);
280     
281     /**
282      * @return the DeadLetterPolicy
283      */
284     public DeadLetterPolicy getDeadLetterPolicy();
285     
286     /**
287      * set the dead letter policy
288      * @param deadLetterPolicy
289      */
290     public void setDeadLetterPolicy(DeadLetterPolicy deadLetterPolicy);
291     
292     /**
293      * Add a message to a dead letter queue
294      * @param deadLetterName
295      * @param message
296      * @throws JMSException
297      */
298     public void sendToDeadLetterQueue(String deadLetterName,ActiveMQMessage message) throws JMSException;
299 
300 }