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 */
017package org.apache.activemq.network;
018
019import javax.management.ObjectName;
020
021import org.apache.activemq.Service;
022
023/**
024 * Represents a network bridge interface
025 */
026public 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 id of the remote broker this bridge is connected to.
058     */
059    String getRemoteBrokerId();
060
061    /**
062     * @return the network address of the local broker connection.
063     */
064    String getLocalAddress();
065
066    /**
067     * @return the name of the local broker this bridge is connected to.
068     */
069    String getLocalBrokerName();
070
071    /**
072     * @return the current number of enqueues this bridge has.
073     */
074    long getEnqueueCounter();
075
076    /**
077     * @return the current number of dequeues this bridge has.
078     */
079    long getDequeueCounter();
080
081    /**
082     * @param objectName
083     *      The ObjectName assigned to this bridge in the MBean server.
084     */
085    void setMbeanObjectName(ObjectName objectName);
086
087    /**
088     * @return the MBean name used to identify this bridge in the MBean server.
089     */
090    ObjectName getMbeanObjectName();
091
092    void resetStats();
093}