View Javadoc

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.broker;
20  
21  import org.codehaus.activemq.message.ActiveMQMessage;
22  import org.codehaus.activemq.service.Service;
23  import org.codehaus.activemq.transport.TransportChannel;
24  
25  /***
26   * A Broker side proxy representing mostly outbound JMS Connnection
27   */
28  
29  public interface BrokerClient extends Service {
30  
31  
32      /***
33       * Initialize the Brokerclient
34       *
35       * @param brokerConnector
36       * @param channel
37       */
38      public void initialize(BrokerConnector brokerConnector, TransportChannel channel);
39  
40      /***
41       * Dispatch an ActiveMQMessage to the end client
42       *
43       * @param message
44       */
45      public void dispatch(ActiveMQMessage message);
46  
47      /***
48       * @return true if the peer for this Client is itself another Broker
49       */
50      public boolean isBrokerConnection();
51      
52      /***
53       * @return true id this client is part of a cluster 
54       */
55      public boolean isClusteredConnection();
56  
57  
58      /***
59       * Get the Capacity for in-progress messages at the peer (probably a JMSConnection)
60       * Legimate values between 0-100. 0 capacity representing that the peer cannot process
61       * any more messages at the current time
62       *
63       * @return
64       */
65      public int getCapacity();
66  
67  
68      /***
69       * Get an indication if the peer should be considered as a slow consumer
70       *
71       * @return true id the peer should be considered as a slow consumer
72       */
73      public boolean isSlowConsumer();
74  
75      /***
76       * Update the peer Connection about the Broker's capacity for messages
77       *
78       * @param capacity
79       */
80      public void updateBrokerCapacity(int capacity);
81  
82      /***
83       * @return the client ID for this client if the client has been initialised
84       */
85      public String getClientID();
86  
87      /***
88       * Called when the transport has been terminated, so do our best to
89       * shut down any resources and deregister from any subscriptions etc
90       */
91      public void cleanUp();
92  
93      /***
94       * @return the TransportChannel
95       */
96      TransportChannel getChannel();
97      
98      /***
99       * @return the BrokerConnector this client is associated with
100      */
101     public BrokerConnector getBrokerConnector();
102 }