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 /***
54 * Get the Capacity for in-progress messages at the peer (probably a JMSConnection)
55 * Legimate values between 0-100. 0 capacity representing that the peer cannot process
56 * any more messages at the current time
57 *
58 * @return
59 */
60 public int getCapacity();
61
62
63 /***
64 * Get an indication if the peer should be considered as a slow consumer
65 *
66 * @return true id the peer should be considered as a slow consumer
67 */
68 public boolean isSlowConsumer();
69
70 /***
71 * Update the peer Connection about the Broker's capacity for messages
72 *
73 * @param capacity
74 */
75 public void updateBrokerCapacity(int capacity);
76
77 /***
78 * Returns the client ID for this client if the client has been initialised
79 */
80 public String getClientID();
81
82 /***
83 * Called when the transport has been terminated, so do our best to
84 * shut down any resources and deregister from any subscriptions etc
85 */
86 public void cleanUp();
87
88 TransportChannel getChannel();
89 }