Class BridgeImpl
java.lang.Object
org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl
- All Implemented Interfaces:
SendAcknowledgementHandler,SessionFailureListener,ClientProducerFlowCallback,PriorityAware,FailureListener,ActiveMQComponent,Bridge,Consumer,ReadyListener
- Direct Known Subclasses:
ClusterConnectionBridge
public class BridgeImpl
extends Object
implements Bridge, SessionFailureListener, SendAcknowledgementHandler, ReadyListener, ClientProducerFlowCallback
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final Executorprotected final Queueprotected final ScheduledExecutorServiceprotected ScheduledFuture<?>protected final ServerLocatorInternalprotected ClientSessionInternalprotected ClientSessionInternalprotected TopologyMemberprotected String -
Constructor Summary
ConstructorsConstructorDescriptionBridgeImpl(ServerLocatorInternal serverLocator, BridgeConfiguration configuration, UUID nodeUUID, Queue queue, Executor executor, ScheduledExecutorService scheduledExecutor, ActiveMQServer server) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidHook for doing extra stuff after connectionprotected MessagebeforeForward(Message message, SimpleString forwardingAddress) Hook for processing message before forwardingprotected MessagebeforeForwardingNoCopy(Message message, SimpleString forwardingAddress) ClusterConnectionBridge already makes a copy of the message.voidbeforeReconnect(ActiveMQException exception) Notifies that a connection has failed due to the specified exception.voidconnectionFailed(ActiveMQException me, boolean failedOver) Notifies that a connection has failed due to the specified exception.voidconnectionFailed(ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID) Notifies that a connection has failed due to the specified exception.protected ClientSessionFactoryInternalHook for creating session factorydebug()voidTo be called when the server sent a disconnect to the client.protected voidfail(boolean permanently, boolean scaleDown) voidvoidstatic final byte[]getDuplicateBytes(UUID nodeUUID, long messageID) The cluster manager needs to use the same executor to close the serverLocator, otherwise the stop will break.getName()getQueue()getState()for use in tests mainlyhandle(MessageReference ref) There was a change on semantic during 2.3 here.booleanbooleanbooleanprotected voidnodeUP(TopologyMember member, boolean last) voidonCreditsFail(ClientProducerCredits producerCredits) voidonCreditsFlow(boolean blocked, ClientProducerCredits producerCredits) voidpause()voidThis will proceed with the actual delivery.voidprotected ClientSessionFactoryInternalvoidresume()protected voidprotected voidprotected voidscheduleRetryConnectFixedTimeout(long milliseconds) voidsendAcknowledged(Message message) Notifies the client that a message sent asynchronously has been received by the server.voidsendFailed(Message message, Exception e) longan unique sequential ID for this consumervoidsetNotificationService(NotificationService notificationService) protected voidvoidstart()voidstop()This method will create a string representation meant for management operations.toString()protected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStopMethods inherited from interface org.apache.activemq.artemis.core.server.Consumer
errorProcessing, getBinding, getPriority, isClosed, promptDelivery, supportsDirectDelivery
-
Field Details
-
serverLocator
-
executor
-
scheduledExecutor
-
queue
-
scheduledReconnection
-
session
-
sessionConsumer
-
disconnectedAndDown
protected volatile boolean disconnectedAndDown -
targetNodeID
-
targetNode
-
-
Constructor Details
-
BridgeImpl
public BridgeImpl(ServerLocatorInternal serverLocator, BridgeConfiguration configuration, UUID nodeUUID, Queue queue, Executor executor, ScheduledExecutorService scheduledExecutor, ActiveMQServer server) throws ActiveMQException - Throws:
ActiveMQException
-
-
Method Details
-
getDuplicateBytes
-
isBlockedOnFlowControl
public boolean isBlockedOnFlowControl() -
getSessionFactory
-
getServerLocator
-
getDeliveringMessages
- Specified by:
getDeliveringMessagesin interfaceConsumer
-
setNotificationService
- Specified by:
setNotificationServicein interfaceBridge
-
onCreditsFlow
- Specified by:
onCreditsFlowin interfaceClientProducerFlowCallback
-
onCreditsFail
- Specified by:
onCreditsFailin interfaceClientProducerFlowCallback
-
sequentialID
public long sequentialID()Description copied from interface:Consumeran unique sequential ID for this consumer- Specified by:
sequentialIDin interfaceConsumer
-
start
- Specified by:
startin interfaceActiveMQComponent- Throws:
Exception
-
debug
-
flushExecutor
public void flushExecutor()- Specified by:
flushExecutorin interfaceBridge
-
disconnect
public void disconnect()Description copied from interface:BridgeTo be called when the server sent a disconnect to the client. Basically this is for cluster bridges being disconnected- Specified by:
disconnectin interfaceBridge- Specified by:
disconnectin interfaceConsumer
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceBridge
-
getExecutor
The cluster manager needs to use the same executor to close the serverLocator, otherwise the stop will break. This method is intended to expose this executor to the ClusterManager -
stop
- Specified by:
stopin interfaceActiveMQComponent- Throws:
Exception
-
pause
-
resume
-
isStarted
public boolean isStarted()- Specified by:
isStartedin interfaceActiveMQComponent
-
getName
-
getQueue
-
getFilter
-
getForwardingAddress
- Specified by:
getForwardingAddressin interfaceBridge
-
getForwardingConnection
- Specified by:
getForwardingConnectionin interfaceBridge
-
sendFailed
- Specified by:
sendFailedin interfaceSendAcknowledgementHandler
-
sendAcknowledged
Description copied from interface:SendAcknowledgementHandlerNotifies the client that a message sent asynchronously has been received by the server.- Specified by:
sendAcknowledgedin interfaceSendAcknowledgementHandler- Parameters:
message- message sent asynchronously
-
failed
-
beforeForward
Hook for processing message before forwarding -
beforeForwardingNoCopy
ClusterConnectionBridge already makes a copy of the message. So I needed I hook where the message is not copied. -
readyForWriting
public void readyForWriting()- Specified by:
readyForWritingin interfaceReadyListener
-
handle
Description copied from interface:ConsumerThere was a change on semantic during 2.3 here.We now first accept the message, and the actual deliver is done as part of
Consumer.proceedDeliver(MessageReference). This is to avoid holding a lock on the queues while the delivery is being accomplished To avoid a lock on the queue in case of misbehaving consumers.This should return busy if handle is called before proceed deliver is called
-
proceedDeliver
Description copied from interface:ConsumerThis will proceed with the actual delivery. Notice that handle should hold a readLock and proceedDelivery should release the readLock any lock operation on Consumer should also get a writeLock on the readWriteLock to guarantee there are no pending deliveries- Specified by:
proceedDeliverin interfaceConsumer
-
connectionFailed
Description copied from interface:FailureListenerNotifies that a connection has failed due to the specified exception.- Specified by:
connectionFailedin interfaceFailureListener- Parameters:
me- exception which has caused the connection to fail
-
connectionFailed
public void connectionFailed(ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID) Description copied from interface:FailureListenerNotifies that a connection has failed due to the specified exception.- Specified by:
connectionFailedin interfaceFailureListener- Parameters:
me- exception which has caused the connection to failscaleDownTargetNodeID- the ID of the node to which messages are scaling down
-
scaleDown
-
tryScheduleRetryReconnect
-
beforeReconnect
Description copied from interface:SessionFailureListenerNotifies that a connection has failed due to the specified exception.This method is called before the session attempts to reconnect/failover.
- Specified by:
beforeReconnectin interfaceSessionFailureListener- Parameters:
exception- exception which has caused the connection to fail
-
getTargetNodeFromTopology
for use in tests mainly -
getMetrics
- Specified by:
getMetricsin interfaceBridge
-
toString
-
toManagementString
Description copied from interface:ConsumerThis method will create a string representation meant for management operations. This is different from the toString method that's meant for debugging and will contain information that regular users won't understand well- Specified by:
toManagementStringin interfaceConsumer
-
getTransformer
-
getConfiguration
- Specified by:
getConfigurationin interfaceBridge
-
getState
-
fail
protected void fail(boolean permanently, boolean scaleDown) -
afterConnect
Hook for doing extra stuff after connection- Throws:
Exception
-
createSessionFactory
Hook for creating session factory- Throws:
Exception
-
reconnectOnOriginalNode
- Throws:
Exception
-
setSessionFactory
-
scheduleRetryConnect
protected void scheduleRetryConnect() -
nodeUP
-
scheduleRetryConnectFixedTimeout
protected void scheduleRetryConnectFixedTimeout(long milliseconds)
-