Interface RemotingConnection
- All Superinterfaces:
BufferHandler
- All Known Implementing Classes:
AbstractRemotingConnection
A RemotingConnection is a connection between a client and a server.
Perhaps a better name for this class now would be ProtocolConnection as this represents the link with the used protocol
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseListener(org.apache.activemq.artemis.core.remoting.CloseListener listener) add a CloseListener.voidaddFailureListener(org.apache.activemq.artemis.core.remoting.FailureListener listener) add a failure listener.Same thing as fail, but using an executor. semantic of send here, is asynchrounous.booleanReturns true if any data has been received since the last time this method was called.voidclose()createTransportBuffer(int size) creates a new ActiveMQBuffer of the specified size.voiddestroy()destroys this connection.voiddisconnect(boolean criticalError) Disconnect the connection, closing all channelsvoiddisconnect(String scaleDownNodeID, boolean criticalError) Disconnect the connection, closing all channelsdefault voiddisconnect(DisconnectReason reason, String targetNodeID, TransportConfiguration targetConnector) Disconnect the connection, closing all channelsvoidcalled when the underlying connection fails.voidfail(ActiveMQException me, String scaleDownTargetNodeID) called when the underlying connection fails.voidflush()flush all outstanding data from the connection.Returns the Client ID associated with this connection.longReturns the creation time of theRemotingConnection.List<org.apache.activemq.artemis.core.remoting.FailureListener> Returns all the failure listeners.getID()Returns the unique id of theRemotingConnection.Returns the name of the protocol for this Remoting Connection.Returns a string representation of the remote address of this connection.the possibly null subject associated with this connectionreturn the underlying Connection.Returns a string representation of the local address this connection is connected to This is useful when the server is configured at 0.0.0.0 (or multiple IPs).booleanisClient()Returns true if theRemotingConnectionis a client, otherwise false.booleanReturns true if thisRemotingConnectionhas been destroyed, otherwise false.default booleanisSameTarget(TransportConfiguration... configs) booleanThis will check if reconnects are supported on the protocol and configuration.booleanReturn true if the protocol supports flow control.booleanisWritable(ReadyListener callback) voidkillMessage(SimpleString nodeID) if slow consumer is killed,send the msessage to client.booleanremoveCloseListener(org.apache.activemq.artemis.core.remoting.CloseListener listener) remove a Close ListenerList<org.apache.activemq.artemis.core.remoting.CloseListener> booleanremoveFailureListener(org.apache.activemq.artemis.core.remoting.FailureListener listener) remove the failure listenerList<org.apache.activemq.artemis.core.remoting.FailureListener> voidvoidsetClientID(String cID) Sets the client ID associated with this connectionvoidsetCloseListeners(List<org.apache.activemq.artemis.core.remoting.CloseListener> listeners) voidsetFailureListeners(List<org.apache.activemq.artemis.core.remoting.FailureListener> listeners) set the failure listeners.voidsetSubject(Subject subject) sets the currently associated subject for this connectionMethods inherited from interface BufferHandler
bufferReceived, endOfBatch
-
Method Details
-
getID
Object getID()Returns the unique id of theRemotingConnection.- Returns:
- the unique id of the
RemotingConnection
-
getCreationTime
long getCreationTime()Returns the creation time of theRemotingConnection.- Returns:
- the creation time of the
RemotingConnection
-
getRemoteAddress
String getRemoteAddress()Returns a string representation of the remote address of this connection.- Returns:
- a string representation of the remote address of this connection
-
scheduledFlush
void scheduledFlush() -
addFailureListener
void addFailureListener(org.apache.activemq.artemis.core.remoting.FailureListener listener) add a failure listener.The listener will be called in the event of connection failure.
- Parameters:
listener- the listener
-
removeFailureListener
boolean removeFailureListener(org.apache.activemq.artemis.core.remoting.FailureListener listener) remove the failure listener- Parameters:
listener- the lister to remove- Returns:
- true if removed
-
addCloseListener
void addCloseListener(org.apache.activemq.artemis.core.remoting.CloseListener listener) add a CloseListener.This will be called in the event of the connection being closed.
- Parameters:
listener- the listener to add
-
removeCloseListener
boolean removeCloseListener(org.apache.activemq.artemis.core.remoting.CloseListener listener) remove a Close Listener- Parameters:
listener- the listener to remove- Returns:
- true if removed
-
removeCloseListeners
List<org.apache.activemq.artemis.core.remoting.CloseListener> removeCloseListeners() -
setCloseListeners
-
getFailureListeners
List<org.apache.activemq.artemis.core.remoting.FailureListener> getFailureListeners()Returns all the failure listeners.- Returns:
- all the failure listeners
-
removeFailureListeners
List<org.apache.activemq.artemis.core.remoting.FailureListener> removeFailureListeners() -
setFailureListeners
set the failure listeners.These will be called in the event of the connection being closed. Any previously added listeners will be removed.
- Parameters:
listeners- the listeners to add.
-
createTransportBuffer
creates a new ActiveMQBuffer of the specified size. For the purpose of i/o outgoing packets- Parameters:
size- the size of buffer required- Returns:
- the buffer
-
fail
called when the underlying connection fails.- Parameters:
me- the exception that caused the failure
-
close
void close() -
asyncFail
Same thing as fail, but using an executor. semantic of send here, is asynchrounous. -
fail
called when the underlying connection fails.- Parameters:
me- the exception that caused the failurescaleDownTargetNodeID- the ID of the node where scale down is targeted
-
destroy
void destroy()destroys this connection. -
getTransportConnection
-
isClient
boolean isClient()Returns true if theRemotingConnectionis a client, otherwise false.- Returns:
- true if the
RemotingConnectionis a client, otherwise false
-
isDestroyed
boolean isDestroyed()Returns true if thisRemotingConnectionhas been destroyed, otherwise false.- Returns:
- true if this
RemotingConnectionhas been destroyed, otherwise false
-
disconnect
void disconnect(boolean criticalError) Disconnect the connection, closing all channels -
disconnect
Disconnect the connection, closing all channels -
disconnect
default void disconnect(DisconnectReason reason, String targetNodeID, TransportConfiguration targetConnector) Disconnect the connection, closing all channels -
checkDataReceived
boolean checkDataReceived()Returns true if any data has been received since the last time this method was called.- Returns:
- true if any data has been received since the last time this method was called
-
flush
void flush()flush all outstanding data from the connection. -
isWritable
-
killMessage
if slow consumer is killed,send the msessage to client. -
isSupportReconnect
boolean isSupportReconnect()This will check if reconnects are supported on the protocol and configuration. In case it's not supported a connection failure could remove messages right away from pending deliveries. -
isSupportsFlowControl
boolean isSupportsFlowControl()Return true if the protocol supports flow control. This is because in some cases we may need to hold message producers in cases like disk full. If the protocol doesn't support it we trash the connection and throw exceptions. -
setSubject
sets the currently associated subject for this connection -
getSubject
Subject getSubject()the possibly null subject associated with this connection -
getProtocolName
String getProtocolName()Returns the name of the protocol for this Remoting Connection.- Returns:
- the name of the protocol for this Remoting Connection
-
setClientID
Sets the client ID associated with this connection -
getClientID
String getClientID()Returns the Client ID associated with this connection.- Returns:
- the Client ID associated with this connection
-
getTransportLocalAddress
String getTransportLocalAddress()Returns a string representation of the local address this connection is connected to This is useful when the server is configured at 0.0.0.0 (or multiple IPs). This will give you the actual IP that's being used.- Returns:
- the local address of transport connection
-
isSameTarget
-