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.message.ActiveMQXid;
    23  import org.codehaus.activemq.message.BrokerInfo;
    24  import org.codehaus.activemq.message.ConnectionInfo;
    25  import org.codehaus.activemq.message.ConsumerInfo;
    26  import org.codehaus.activemq.message.DurableUnsubscribe;
    27  import org.codehaus.activemq.message.MessageAck;
    28  import org.codehaus.activemq.message.ProducerInfo;
    29  import org.codehaus.activemq.message.SessionInfo;
    30  import org.codehaus.activemq.service.Service;
    31  import org.codehaus.activemq.transport.TransportServerChannel;
    32
    33  import javax.jms.JMSException;
    34  import javax.jms.JMSSecurityException;
    35  import javax.transaction.xa.XAException;
    36
    37  /***
    38   * The Broker is the client side interface to the JMS server
    39   *
    40   * @version $Revision: 1.4 $
    41   */
    42  public interface BrokerConnector extends Service {
    43
    44      /***
    45       * @return infomation about the Broker
    46       */
    47      public BrokerInfo getBrokerInfo();
    48
    49      /***
    50       * @return the transport channel this broker is using
    51       */
    52      public TransportServerChannel getServerChannel();
    53
    54      /***
    55       * Get a hint about the broker capacity for more messages
    56       *
    57       * @return percentage value (0-100) about how much capacity the
    58       *         broker has
    59       */
    60      public int getBrokerCapacity();
    61
    62      /***
    63       * Register a Broker Client
    64       *
    65       * @param client
    66       * @param info   contains infomation about the Connection this Client
    67       *               represents
    68       * @throws JMSException
    69       * @throws javax.jms.InvalidClientIDException
    70       *                              if the JMS client specifies an invalid or duplicate client
    71       *                              ID.
    72       * @throws JMSSecurityException if client authentication fails due to an invalid user name or
    73       *                              password.
    74       */
    75      public void registerClient(BrokerClient client, ConnectionInfo info) throws JMSException;
    76
    77      /***
    78       * Deregister a Broker Client
    79       *
    80       * @param client
    81       * @param info
    82       * @throws JMSException if some internal error occurs
    83       */
    84
    85      public void deregisterClient(BrokerClient client, ConnectionInfo info) throws JMSException;
    86
    87      /***
    88       * Registers a MessageConsumer
    89       *
    90       * @param client
    91       * @param info
    92       * @throws JMSException
    93       * @throws JMSSecurityException if client authentication fails for the Destination the
    94       *                              Consumer applies for
    95       */
    96      public void registerMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException;
    97
    98      /***
    99       * De-register a MessageConsumer from the Broker
    100      *
    101      * @param client
    102      * @param info
    103      * @throws JMSException
    104      */
    105     public void deregisterMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException;
    106
    107     /***
    108      * Registers a MessageProducer
    109      *
    110      * @param client
    111      * @param info
    112      * @throws JMSException
    113      * @throws JMSSecurityException if client authentication fails for the Destination the
    114      *                              Consumer applies for
    115      */
    116
    117     public void registerMessageProducer(BrokerClient client, ProducerInfo info) throws JMSException;
    118
    119     /***
    120      * De-register a MessageProducer from the Broker
    121      *
    122      * @param client
    123      * @param info
    124      * @throws JMSException
    125      */
    126     public void deregisterMessageProducer(BrokerClient client, ProducerInfo info) throws JMSException;
    127
    128     /***
    129      * Register a client-side Session (used for Monitoring)
    130      *
    131      * @param client
    132      * @param info
    133      * @throws JMSException
    134      */
    135
    136     public void registerSession(BrokerClient client, SessionInfo info) throws JMSException;
    137
    138     /***
    139      * De-register a client-side Session from the Broker (used for monitoring)
    140      *
    141      * @param client
    142      * @param info
    143      * @throws JMSException
    144      */
    145     public void deregisterSession(BrokerClient client, SessionInfo info) throws JMSException;
    146
    147     /***
    148      * Start a transaction from the Client session
    149      *
    150      * @param client
    151      * @param transactionId
    152      * @throws JMSException
    153      */
    154     public void startTransaction(BrokerClient client, String transactionId) throws JMSException;
    155
    156     /***
    157      * Rollback a transacton
    158      *
    159      * @param client
    160      * @param transactionId
    161      * @throws JMSException
    162      */
    163     public void rollbackTransaction(BrokerClient client, String transactionId) throws JMSException;
    164
    165     /***
    166      * Commit a transaction
    167      *
    168      * @param client
    169      * @param transactionId
    170      * @throws JMSException
    171      */
    172     public void commitTransaction(BrokerClient client, String transactionId) throws JMSException;
    173
    174
    175     /***
    176      * Start an XA transaction
    177      *
    178      * @param client
    179      * @param xid
    180      * @throws XAException
    181      */
    182     public void startTransaction(BrokerClient client, ActiveMQXid xid) throws XAException;
    183
    184     /***
    185      * Get all the Xids of the prepared XA transactions.
    186      *
    187      * @param client
    188      * @return
    189      * @throws XAException
    190      */
    191     public ActiveMQXid[] getPreparedTransactions(BrokerClient client) throws XAException;
    192
    193     /***
    194      * Prepare an XA transaction.
    195      *
    196      * @param client
    197      * @param xid
    198      * @return
    199      * @throws XAException
    200      */
    201     public int prepareTransaction(BrokerClient client, ActiveMQXid xid) throws XAException;
    202
    203     /***
    204      * Rollback an XA transaction.
    205      *
    206      * @param client
    207      * @param xid
    208      * @throws XAException
    209      */
    210     public void rollbackTransaction(BrokerClient client, ActiveMQXid xid) throws XAException;
    211
    212     /***
    213      * Commit an XA transaction.
    214      *
    215      * @param client
    216      * @param xid
    217      * @param onePhase
    218      * @throws XAException
    219      */
    220     public void commitTransaction(BrokerClient client, ActiveMQXid xid, boolean onePhase) throws XAException;
    221
    222     /***
    223      * send message with a transaction context
    224      *
    225      * @param client
    226      * @param transactionId
    227      * @param message
    228      * @throws JMSException
    229      */
    230     public void sendTransactedMessage(BrokerClient client, String transactionId, ActiveMQMessage message)
    231             throws JMSException;
    232
    233     /***
    234      * Acknowledge receipt of a message within a transaction context
    235      *
    236      * @param client
    237      * @param transactionId
    238      * @param ack
    239      * @throws JMSException
    240      */
    241     public void acknowledgeTransactedMessage(BrokerClient client, String transactionId, MessageAck ack)
    242             throws JMSException;
    243
    244     /***
    245      * Send a non-transacted message to the Broker
    246      *
    247      * @param client
    248      * @param message
    249      * @throws JMSException
    250      */
    251
    252     public void sendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException;
    253
    254     /***
    255      * Acknowledge reciept of a message
    256      *
    257      * @param client
    258      * @param ack
    259      * @throws JMSException
    260      */
    261     public void acknowledgeMessage(BrokerClient client, MessageAck ack) throws JMSException;
    262
    263     /***
    264      * Command to delete a durable topic subscription
    265      *
    266      * @param client
    267      * @param ds
    268      * @throws JMSException
    269      */
    270
    271     public void durableUnsubscribe(BrokerClient client, DurableUnsubscribe ds) throws JMSException;
    272
    273     /***
    274      * Gets the unique id of the resource manager used for managing xa
    275      * transactions.
    276      *
    277      * @param client
    278      * @return the id
    279      */
    280     public String getResourceManagerId(BrokerClient client);
    281
    282     /***
    283      * @return the BrokerContainer for this Connector
    284      */
    285     public BrokerContainer getBrokerContainer();
    286
    287
    288 }