public abstract class DemandForwardingBridgeSupport extends Object implements NetworkBridge, BrokerServiceAware
| Modifier and Type | Field and Description |
|---|---|
protected AtomicBoolean |
bridgeFailed |
protected BrokerService |
brokerService |
protected NetworkBridgeConfiguration |
configuration |
protected org.apache.activemq.util.LongSequenceGenerator |
consumerIdGenerator |
protected NetworkBridgeFilterFactory |
defaultFilterFactory |
protected int |
demandConsumerDispatched |
protected org.apache.activemq.command.ConsumerInfo |
demandConsumerInfo |
protected AtomicBoolean |
disposed |
protected static String |
DURABLE_SUB_PREFIX |
protected org.apache.activemq.command.ActiveMQDestination[] |
durableDestinations |
protected org.apache.activemq.command.ActiveMQDestination[] |
dynamicallyIncludedDestinations |
protected org.apache.activemq.command.ActiveMQDestination[] |
excludedDestinations |
protected Set<org.apache.activemq.command.ConsumerId> |
forcedDurableRemoteId |
protected org.apache.activemq.util.IdGenerator |
idGenerator |
protected AtomicBoolean |
lastConnectSucceeded |
protected AtomicBoolean |
localBridgeStarted |
protected org.apache.activemq.transport.Transport |
localBroker |
protected org.apache.activemq.command.BrokerId |
localBrokerId |
protected org.apache.activemq.command.BrokerId[] |
localBrokerPath |
protected String |
localClientId |
protected org.apache.activemq.command.ConnectionInfo |
localConnectionInfo |
protected org.apache.activemq.command.SessionInfo |
localSessionInfo |
protected CountDownLatch |
localStartedLatch |
protected NetworkBridgeStatistics |
networkBridgeStatistics |
protected org.apache.activemq.command.ProducerInfo |
producerInfo |
protected AtomicBoolean |
remoteBridgeStarted |
protected org.apache.activemq.transport.Transport |
remoteBroker |
protected org.apache.activemq.command.BrokerId |
remoteBrokerId |
protected String |
remoteBrokerName |
protected org.apache.activemq.command.BrokerId[] |
remoteBrokerPath |
protected org.apache.activemq.command.ConnectionInfo |
remoteConnectionInfo |
protected CountDownLatch |
startedLatch |
protected org.apache.activemq.command.ActiveMQDestination[] |
staticallyIncludedDestinations |
protected CountDownLatch |
staticDestinationsLatch |
protected ConcurrentMap<org.apache.activemq.command.ConsumerId,DemandSubscription> |
subscriptionMapByLocalId |
protected ConcurrentMap<org.apache.activemq.command.ConsumerId,DemandSubscription> |
subscriptionMapByRemoteId |
| Constructor and Description |
|---|
DemandForwardingBridgeSupport(NetworkBridgeConfiguration configuration,
org.apache.activemq.transport.Transport localBroker,
org.apache.activemq.transport.Transport remoteBroker) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addConsumerInfo(org.apache.activemq.command.ConsumerInfo consumerInfo) |
protected void |
addProxyNetworkSubscriptionBrokerPath(DemandSubscription sub,
org.apache.activemq.command.BrokerId[] path,
String subName)
Add a durable remote proxy subscription when we can generate via the BrokerId path
This is the most common scenario
|
protected void |
addProxyNetworkSubscriptionClientId(DemandSubscription sub,
String clientId,
String subName)
This scenaior is primarily used for durable sync on broker restarts
|
protected void |
addRemoteBrokerToBrokerPath(org.apache.activemq.command.ConsumerInfo info) |
protected void |
addSubscription(DemandSubscription sub) |
protected org.apache.activemq.command.BrokerId[] |
appendToBrokerPath(org.apache.activemq.command.BrokerId[] brokerPath,
org.apache.activemq.command.BrokerId idToAppend) |
protected org.apache.activemq.command.BrokerId[] |
appendToBrokerPath(org.apache.activemq.command.BrokerId[] brokerPath,
org.apache.activemq.command.BrokerId[] pathsToAppend) |
protected boolean |
canDuplexDispatch(org.apache.activemq.command.Message message) |
protected void |
configureConsumerPrefetch(org.apache.activemq.command.ConsumerInfo consumerInfo) |
protected void |
configureDemandSubscription(org.apache.activemq.command.ConsumerInfo info,
DemandSubscription sub) |
protected org.apache.activemq.command.Message |
configureMessage(org.apache.activemq.command.MessageDispatch md) |
static boolean |
contains(org.apache.activemq.command.BrokerId[] brokerPath,
org.apache.activemq.command.BrokerId brokerId) |
protected DemandSubscription |
createDemandSubscription(org.apache.activemq.command.ActiveMQDestination destination,
String subscriptionName) |
protected DemandSubscription |
createDemandSubscription(org.apache.activemq.command.ConsumerInfo info) |
protected org.apache.activemq.command.NetworkBridgeFilter |
createNetworkBridgeFilter(org.apache.activemq.command.ConsumerInfo info) |
protected DemandSubscription |
doCreateDemandSubscription(org.apache.activemq.command.ConsumerInfo info) |
void |
duplexStart(TransportConnection connection,
org.apache.activemq.command.BrokerInfo localBrokerInfo,
org.apache.activemq.command.BrokerInfo remoteBrokerInfo) |
protected org.apache.activemq.Service |
getControllingService() |
long |
getDequeueCounter() |
org.apache.activemq.command.ActiveMQDestination[] |
getDurableDestinations() |
org.apache.activemq.command.ActiveMQDestination[] |
getDynamicallyIncludedDestinations() |
long |
getEnqueueCounter() |
org.apache.activemq.command.ActiveMQDestination[] |
getExcludedDestinations() |
String |
getLocalAddress() |
org.apache.activemq.transport.Transport |
getLocalBroker() |
String |
getLocalBrokerName() |
ConcurrentMap<org.apache.activemq.command.ConsumerId,DemandSubscription> |
getLocalSubscriptionMap() |
ObjectName |
getMbeanObjectName() |
NetworkBridgeStatistics |
getNetworkBridgeStatistics() |
protected Collection<Subscription> |
getRegionSubscriptions(org.apache.activemq.command.ActiveMQDestination dest) |
String |
getRemoteAddress() |
org.apache.activemq.transport.Transport |
getRemoteBroker() |
String |
getRemoteBrokerId() |
String |
getRemoteBrokerName() |
protected org.apache.activemq.command.BrokerId[] |
getRemoteBrokerPath() |
org.apache.activemq.command.ActiveMQDestination[] |
getStaticallyIncludedDestinations() |
protected long |
getStoredSequenceIdForMessage(org.apache.activemq.command.MessageId messageId) |
boolean |
isCreatedByDuplex() |
protected boolean |
isDirectBridgeConsumer(org.apache.activemq.command.ConsumerInfo info)
Checks whether or not this consumer is a direct bridge network subscription
|
protected boolean |
isDuplex() |
protected boolean |
isPermissableDestination(org.apache.activemq.command.ActiveMQDestination destination) |
protected boolean |
isPermissableDestination(org.apache.activemq.command.ActiveMQDestination destination,
boolean allowTemporary) |
protected boolean |
isProxyBridgeSubscription(String clientId,
String subName) |
protected boolean |
isProxyNSConsumerBrokerPath(org.apache.activemq.command.ConsumerInfo info) |
protected boolean |
isProxyNSConsumerClientId(String clientId) |
protected void |
removeDemandSubscription(org.apache.activemq.command.ConsumerId id) |
protected boolean |
removeDemandSubscriptionByLocalId(org.apache.activemq.command.ConsumerId consumerId) |
protected void |
removeSubscription(DemandSubscription sub) |
void |
resetStats() |
protected boolean |
safeWaitUntilStarted()
Performs a timed wait on the started latch and then checks for disposed
before performing another wait each time the the started wait times out.
|
protected void |
serviceInboundMessage(org.apache.activemq.command.Message message) |
protected void |
serviceLocalCommand(org.apache.activemq.command.Command command) |
void |
serviceLocalException(org.apache.activemq.command.MessageDispatch messageDispatch,
Throwable error) |
void |
serviceLocalException(Throwable error)
Service an exception received from the Local Broker connection.
|
protected void |
serviceOutbound(org.apache.activemq.command.Message message) |
protected void |
serviceRemoteCommand(org.apache.activemq.command.Command command) |
void |
serviceRemoteException(Throwable error)
Service an exception received from the Remote Broker connection.
|
void |
setBrokerService(BrokerService brokerService) |
void |
setCreatedByDuplex(boolean createdByDuplex) |
void |
setDurableDestinations(org.apache.activemq.command.ActiveMQDestination[] durableDestinations) |
void |
setDynamicallyIncludedDestinations(org.apache.activemq.command.ActiveMQDestination[] dynamicallyIncludedDestinations) |
void |
setExcludedDestinations(org.apache.activemq.command.ActiveMQDestination[] excludedDestinations) |
void |
setMbeanObjectName(ObjectName objectName) |
void |
setNetworkBridgeListener(NetworkBridgeListener listener)
Set the NetworkBridgeFailedListener
|
void |
setStaticallyIncludedDestinations(org.apache.activemq.command.ActiveMQDestination[] staticallyIncludedDestinations) |
protected void |
setupStaticDestinations()
Subscriptions for these destinations are always created
|
void |
start() |
protected void |
startRemoteBridge() |
void |
stop() |
protected void |
triggerStartAsyncNetworkBridgeCreation() |
protected static final String DURABLE_SUB_PREFIX
protected final org.apache.activemq.transport.Transport localBroker
protected final org.apache.activemq.transport.Transport remoteBroker
protected org.apache.activemq.util.IdGenerator idGenerator
protected final org.apache.activemq.util.LongSequenceGenerator consumerIdGenerator
protected org.apache.activemq.command.ConnectionInfo localConnectionInfo
protected org.apache.activemq.command.ConnectionInfo remoteConnectionInfo
protected org.apache.activemq.command.SessionInfo localSessionInfo
protected org.apache.activemq.command.ProducerInfo producerInfo
protected String remoteBrokerName
protected String localClientId
protected org.apache.activemq.command.ConsumerInfo demandConsumerInfo
protected int demandConsumerDispatched
protected final AtomicBoolean localBridgeStarted
protected final AtomicBoolean remoteBridgeStarted
protected final AtomicBoolean bridgeFailed
protected final AtomicBoolean disposed
protected org.apache.activemq.command.BrokerId localBrokerId
protected org.apache.activemq.command.ActiveMQDestination[] excludedDestinations
protected org.apache.activemq.command.ActiveMQDestination[] dynamicallyIncludedDestinations
protected org.apache.activemq.command.ActiveMQDestination[] staticallyIncludedDestinations
protected org.apache.activemq.command.ActiveMQDestination[] durableDestinations
protected final ConcurrentMap<org.apache.activemq.command.ConsumerId,DemandSubscription> subscriptionMapByLocalId
protected final ConcurrentMap<org.apache.activemq.command.ConsumerId,DemandSubscription> subscriptionMapByRemoteId
protected final Set<org.apache.activemq.command.ConsumerId> forcedDurableRemoteId
protected final org.apache.activemq.command.BrokerId[] localBrokerPath
protected final CountDownLatch startedLatch
protected final CountDownLatch localStartedLatch
protected final CountDownLatch staticDestinationsLatch
protected final AtomicBoolean lastConnectSucceeded
protected NetworkBridgeConfiguration configuration
protected final NetworkBridgeFilterFactory defaultFilterFactory
protected final org.apache.activemq.command.BrokerId[] remoteBrokerPath
protected org.apache.activemq.command.BrokerId remoteBrokerId
protected final NetworkBridgeStatistics networkBridgeStatistics
protected BrokerService brokerService
public DemandForwardingBridgeSupport(NetworkBridgeConfiguration configuration, org.apache.activemq.transport.Transport localBroker, org.apache.activemq.transport.Transport remoteBroker)
public void duplexStart(TransportConnection connection, org.apache.activemq.command.BrokerInfo localBrokerInfo, org.apache.activemq.command.BrokerInfo remoteBrokerInfo) throws Exception
Exceptionpublic void start() throws Exception
start in interface org.apache.activemq.ServiceExceptionpublic void stop() throws Exception
stop in interface org.apache.activemq.ServiceExceptionprotected void triggerStartAsyncNetworkBridgeCreation() throws IOException
IOExceptionprotected void startRemoteBridge() throws Exception
Exceptionpublic void serviceRemoteException(Throwable error)
NetworkBridgeserviceRemoteException in interface NetworkBridgeprotected boolean isDirectBridgeConsumer(org.apache.activemq.command.ConsumerInfo info)
info - protected boolean isProxyBridgeSubscription(String clientId, String subName)
protected void addProxyNetworkSubscriptionClientId(DemandSubscription sub, String clientId, String subName)
sub - clientId - subName - protected void addProxyNetworkSubscriptionBrokerPath(DemandSubscription sub, org.apache.activemq.command.BrokerId[] path, String subName)
sub - path - subName - protected boolean isProxyNSConsumerBrokerPath(org.apache.activemq.command.ConsumerInfo info)
protected boolean isProxyNSConsumerClientId(String clientId)
protected void serviceRemoteCommand(org.apache.activemq.command.Command command)
public void serviceLocalException(Throwable error)
NetworkBridgeserviceLocalException in interface NetworkBridgepublic void serviceLocalException(org.apache.activemq.command.MessageDispatch messageDispatch, Throwable error)
protected org.apache.activemq.Service getControllingService()
protected void addSubscription(DemandSubscription sub) throws IOException
IOExceptionprotected void removeSubscription(DemandSubscription sub) throws IOException
IOExceptionprotected org.apache.activemq.command.Message configureMessage(org.apache.activemq.command.MessageDispatch md) throws IOException
IOExceptionprotected void serviceLocalCommand(org.apache.activemq.command.Command command)
public static boolean contains(org.apache.activemq.command.BrokerId[] brokerPath, org.apache.activemq.command.BrokerId brokerId)
protected org.apache.activemq.command.BrokerId[] appendToBrokerPath(org.apache.activemq.command.BrokerId[] brokerPath, org.apache.activemq.command.BrokerId[] pathsToAppend)
protected org.apache.activemq.command.BrokerId[] appendToBrokerPath(org.apache.activemq.command.BrokerId[] brokerPath, org.apache.activemq.command.BrokerId idToAppend)
protected boolean isPermissableDestination(org.apache.activemq.command.ActiveMQDestination destination)
protected boolean isPermissableDestination(org.apache.activemq.command.ActiveMQDestination destination, boolean allowTemporary)
protected void setupStaticDestinations()
protected void addConsumerInfo(org.apache.activemq.command.ConsumerInfo consumerInfo) throws IOException
IOExceptionprotected final Collection<Subscription> getRegionSubscriptions(org.apache.activemq.command.ActiveMQDestination dest)
protected DemandSubscription createDemandSubscription(org.apache.activemq.command.ConsumerInfo info) throws IOException
IOExceptionprotected DemandSubscription doCreateDemandSubscription(org.apache.activemq.command.ConsumerInfo info) throws IOException
IOExceptionprotected final DemandSubscription createDemandSubscription(org.apache.activemq.command.ActiveMQDestination destination, String subscriptionName)
protected void configureDemandSubscription(org.apache.activemq.command.ConsumerInfo info, DemandSubscription sub) throws IOException
IOExceptionprotected void removeDemandSubscription(org.apache.activemq.command.ConsumerId id) throws IOException
IOExceptionprotected boolean removeDemandSubscriptionByLocalId(org.apache.activemq.command.ConsumerId consumerId)
protected boolean safeWaitUntilStarted() throws InterruptedException
InterruptedExceptionprotected org.apache.activemq.command.NetworkBridgeFilter createNetworkBridgeFilter(org.apache.activemq.command.ConsumerInfo info) throws IOException
IOExceptionprotected void addRemoteBrokerToBrokerPath(org.apache.activemq.command.ConsumerInfo info) throws IOException
IOExceptionprotected org.apache.activemq.command.BrokerId[] getRemoteBrokerPath()
public void setNetworkBridgeListener(NetworkBridgeListener listener)
NetworkBridgesetNetworkBridgeListener in interface NetworkBridgepublic org.apache.activemq.command.ActiveMQDestination[] getDynamicallyIncludedDestinations()
public void setDynamicallyIncludedDestinations(org.apache.activemq.command.ActiveMQDestination[] dynamicallyIncludedDestinations)
dynamicallyIncludedDestinations - The dynamicallyIncludedDestinations to set.public org.apache.activemq.command.ActiveMQDestination[] getExcludedDestinations()
public void setExcludedDestinations(org.apache.activemq.command.ActiveMQDestination[] excludedDestinations)
excludedDestinations - The excludedDestinations to set.public org.apache.activemq.command.ActiveMQDestination[] getStaticallyIncludedDestinations()
public void setStaticallyIncludedDestinations(org.apache.activemq.command.ActiveMQDestination[] staticallyIncludedDestinations)
staticallyIncludedDestinations - The staticallyIncludedDestinations to set.public org.apache.activemq.command.ActiveMQDestination[] getDurableDestinations()
public void setDurableDestinations(org.apache.activemq.command.ActiveMQDestination[] durableDestinations)
durableDestinations - The durableDestinations to set.public org.apache.activemq.transport.Transport getLocalBroker()
public org.apache.activemq.transport.Transport getRemoteBroker()
public boolean isCreatedByDuplex()
public void setCreatedByDuplex(boolean createdByDuplex)
createdByDuplex - the createdByDuplex to setpublic String getRemoteAddress()
getRemoteAddress in interface NetworkBridgepublic String getLocalAddress()
getLocalAddress in interface NetworkBridgepublic String getRemoteBrokerName()
getRemoteBrokerName in interface NetworkBridgepublic String getRemoteBrokerId()
getRemoteBrokerId in interface NetworkBridgepublic String getLocalBrokerName()
getLocalBrokerName in interface NetworkBridgepublic long getDequeueCounter()
getDequeueCounter in interface NetworkBridgepublic long getEnqueueCounter()
getEnqueueCounter in interface NetworkBridgepublic NetworkBridgeStatistics getNetworkBridgeStatistics()
getNetworkBridgeStatistics in interface NetworkBridgeprotected boolean isDuplex()
public ConcurrentMap<org.apache.activemq.command.ConsumerId,DemandSubscription> getLocalSubscriptionMap()
public void setBrokerService(BrokerService brokerService)
setBrokerService in interface BrokerServiceAwarepublic void setMbeanObjectName(ObjectName objectName)
setMbeanObjectName in interface NetworkBridgeobjectName - The ObjectName assigned to this bridge in the MBean server.public ObjectName getMbeanObjectName()
getMbeanObjectName in interface NetworkBridgepublic void resetStats()
resetStats in interface NetworkBridgeprotected void serviceOutbound(org.apache.activemq.command.Message message)
protected void serviceInboundMessage(org.apache.activemq.command.Message message)
protected boolean canDuplexDispatch(org.apache.activemq.command.Message message)
protected long getStoredSequenceIdForMessage(org.apache.activemq.command.MessageId messageId)
protected void configureConsumerPrefetch(org.apache.activemq.command.ConsumerInfo consumerInfo)
Copyright © 2005–2020 The Apache Software Foundation. All rights reserved.