001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.activemq.network;
018    
019    import javax.management.ObjectName;
020    
021    import org.apache.activemq.Service;
022    
023    /**
024     * Represents a network bridge interface
025     */
026    public interface NetworkBridge extends Service {
027    
028        /**
029         * Service an exception received from the Remote Broker connection.
030         * @param error
031         */
032        void serviceRemoteException(Throwable error);
033    
034        /**
035         * Service an exception received from the Local Broker connection.
036         * @param error
037         */
038        void serviceLocalException(Throwable error);
039    
040        /**
041         * Set the NetworkBridgeFailedListener
042         * @param listener
043         */
044        void setNetworkBridgeListener(NetworkBridgeListener listener);
045    
046        /**
047         * @return the network address of the remote broker connection.
048         */
049        String getRemoteAddress();
050    
051        /**
052         * @return the name of the remote broker this bridge is connected to.
053         */
054        String getRemoteBrokerName();
055    
056        /**
057         * @return the network address of the local broker connection.
058         */
059        String getLocalAddress();
060    
061        /**
062         * @return the name of the local broker this bridge is connected to.
063         */
064        String getLocalBrokerName();
065    
066        /**
067         * @return the current number of enqueues this bridge has.
068         */
069        long getEnqueueCounter();
070    
071        /**
072         * @return the current number of dequeues this bridge has.
073         */
074        long getDequeueCounter();
075    
076        /**
077         * @param objectName
078         *      The ObjectName assigned to this bridge in the MBean server.
079         */
080        void setMbeanObjectName(ObjectName objectName);
081    
082        /**
083         * @return the MBean name used to identify this bridge in the MBean server.
084         */
085        ObjectName getMbeanObjectName();
086    }