Package org.apache.activemq.broker
Class TransportConnector
- java.lang.Object
-
- org.apache.activemq.broker.TransportConnector
-
- All Implemented Interfaces:
BrokerServiceAware,Connector,Service
- Direct Known Subclasses:
ManagedTransportConnector
public class TransportConnector extends Object implements Connector, BrokerServiceAware
-
-
Field Summary
Fields Modifier and Type Field Description protected CopyOnWriteArrayList<TransportConnection>connectionsprotected TransportStatusDetectorstatusDector
-
Constructor Summary
Constructors Constructor Description TransportConnector()TransportConnector(TransportServer server)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPeerBroker(BrokerInfo info)ManagedTransportConnectorasManagedConnector(ManagementContext context, ObjectName connectorName)Factory method to create a JMX managed version of this transport connectorintconnectionCount()protected ConnectioncreateConnection(Transport transport)protected DiscoveryAgentcreateDiscoveryAgent()protected TransportServercreateTransportServer()BrokergetBroker()BrokerInfogetBrokerInfo()BrokerServicegetBrokerService()protected ConnectionControlgetConnectionControl()CopyOnWriteArrayList<TransportConnection>getConnections()URIgetConnectUri()DiscoveryAgentgetDiscoveryAgent()URIgetDiscoveryUri()intgetMaximumConsumersAllowedPerConnection()intgetMaximumProducersAllowedPerConnection()MessageAuthorizationPolicygetMessageAuthorizationPolicy()StringgetName()LinkedList<String>getPeerBrokers()StringgetPublishableConnectString()URIgetPublishableConnectURI()PublishedAddressPolicygetPublishedAddressPolicy()Gets the currently configured policy for creating the published connection address of this TransportConnector.static ThrowablegetRootCause(Throwable throwable)TransportServergetServer()ConnectorStatisticsgetStatistics()TaskRunnerFactorygetTaskRunnerFactory()StringgetUpdateClusterFilter()URIgetUri()booleanisAllowLinkStealing()If enabled, older connections with the same clientID are stoppedbooleanisAuditNetworkProducers()booleanisDisableAsyncDispatch()booleanisDisplayStackTrace()booleanisEnableStatusMonitor()booleanisRebalanceClusterClients()booleanisUpdateClusterClients()booleanisUpdateClusterClientsOnRemove()booleanisWarnOnRemoteClose()voidonStarted(TransportConnection connection)voidonStopped(TransportConnection connection)voidremovePeerBroker(BrokerInfo info)voidsetAllowLinkStealing(boolean allowLinkStealing)voidsetAuditNetworkProducers(boolean auditNetworkProducers)Enable a producer audit on network connections, Traps the case of a missing send reply and resend.voidsetBrokerInfo(BrokerInfo brokerInfo)voidsetBrokerService(BrokerService brokerService)This is called by the BrokerService right before it starts the transport.voidsetDisableAsyncDispatch(boolean disableAsyncDispatch)voidsetDiscoveryAgent(DiscoveryAgent discoveryAgent)voidsetDiscoveryUri(URI discoveryUri)voidsetDisplayStackTrace(boolean displayStackTrace)voidsetEnableStatusMonitor(boolean enableStatusMonitor)voidsetMaximumConsumersAllowedPerConnection(int maximumConsumersAllowedPerConnection)voidsetMaximumProducersAllowedPerConnection(int maximumProducersAllowedPerConnection)voidsetMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy)Sets the policy used to decide if the current connection is authorized to consume a given messagevoidsetName(String name)voidsetPublishedAddressPolicy(PublishedAddressPolicy publishedAddressPolicy)Sets the configured policy for creating the published connection address of this TransportConnector.voidsetRebalanceClusterClients(boolean rebalanceClusterClients)voidsetServer(TransportServer server)voidsetTaskRunnerFactory(TaskRunnerFactory taskRunnerFactory)voidsetUpdateClusterClients(boolean updateClusterClients)voidsetUpdateClusterClientsOnRemove(boolean updateClusterClientsOnRemove)voidsetUpdateClusterFilter(String updateClusterFilter)voidsetUri(URI uri)Sets the server transport URI to use if there is not aTransportServerconfigured via thesetServer(TransportServer)method.voidsetWarnOnRemoteClose(boolean warnOnRemoteClose)voidstart()voidstop()StringtoString()voidupdateClientClusterInfo()Update all the connections with information about the connected brokers in the cluster
-
-
-
Field Detail
-
connections
protected final CopyOnWriteArrayList<TransportConnection> connections
-
statusDector
protected TransportStatusDetector statusDector
-
-
Constructor Detail
-
TransportConnector
public TransportConnector()
-
TransportConnector
public TransportConnector(TransportServer server)
-
-
Method Detail
-
getConnections
public CopyOnWriteArrayList<TransportConnection> getConnections()
- Returns:
- Returns the connections.
-
asManagedConnector
public ManagedTransportConnector asManagedConnector(ManagementContext context, ObjectName connectorName) throws IOException, URISyntaxException
Factory method to create a JMX managed version of this transport connector- Throws:
IOExceptionURISyntaxException
-
getBrokerInfo
public BrokerInfo getBrokerInfo()
- Specified by:
getBrokerInfoin interfaceConnector- Returns:
- brokerInfo
-
setBrokerInfo
public void setBrokerInfo(BrokerInfo brokerInfo)
-
getServer
public TransportServer getServer() throws IOException, URISyntaxException
- Throws:
IOExceptionURISyntaxException
-
setServer
public void setServer(TransportServer server)
-
getUri
public URI getUri()
-
setUri
public void setUri(URI uri)
Sets the server transport URI to use if there is not aTransportServerconfigured via thesetServer(TransportServer)method. This value is used to lazy create aTransportServerinstance- Parameters:
uri-
-
getTaskRunnerFactory
public TaskRunnerFactory getTaskRunnerFactory()
-
setTaskRunnerFactory
public void setTaskRunnerFactory(TaskRunnerFactory taskRunnerFactory)
-
getStatistics
public ConnectorStatistics getStatistics()
- Specified by:
getStatisticsin interfaceConnector- Returns:
- the statistics for this connector
-
getMessageAuthorizationPolicy
public MessageAuthorizationPolicy getMessageAuthorizationPolicy()
-
setMessageAuthorizationPolicy
public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy)
Sets the policy used to decide if the current connection is authorized to consume a given message
-
start
public void start() throws Exception
-
getPublishableConnectString
public String getPublishableConnectString() throws Exception
- Throws:
Exception
-
createConnection
protected Connection createConnection(Transport transport) throws IOException
- Throws:
IOException
-
createTransportServer
protected TransportServer createTransportServer() throws IOException, URISyntaxException
- Throws:
IOExceptionURISyntaxException
-
getDiscoveryAgent
public DiscoveryAgent getDiscoveryAgent() throws IOException
- Throws:
IOException
-
createDiscoveryAgent
protected DiscoveryAgent createDiscoveryAgent() throws IOException
- Throws:
IOException
-
setDiscoveryAgent
public void setDiscoveryAgent(DiscoveryAgent discoveryAgent)
-
getDiscoveryUri
public URI getDiscoveryUri()
-
setDiscoveryUri
public void setDiscoveryUri(URI discoveryUri)
-
getConnectUri
public URI getConnectUri() throws IOException, URISyntaxException
- Throws:
IOExceptionURISyntaxException
-
onStarted
public void onStarted(TransportConnection connection)
-
onStopped
public void onStopped(TransportConnection connection)
-
getName
public String getName()
-
setName
public void setName(String name)
-
getConnectionControl
protected ConnectionControl getConnectionControl()
-
addPeerBroker
public void addPeerBroker(BrokerInfo info)
-
removePeerBroker
public void removePeerBroker(BrokerInfo info)
-
getPeerBrokers
public LinkedList<String> getPeerBrokers()
-
updateClientClusterInfo
public void updateClientClusterInfo()
Description copied from interface:ConnectorUpdate all the connections with information about the connected brokers in the cluster- Specified by:
updateClientClusterInfoin interfaceConnector
-
isDisableAsyncDispatch
public boolean isDisableAsyncDispatch()
-
setDisableAsyncDispatch
public void setDisableAsyncDispatch(boolean disableAsyncDispatch)
-
isEnableStatusMonitor
public boolean isEnableStatusMonitor()
- Returns:
- the enableStatusMonitor
-
setEnableStatusMonitor
public void setEnableStatusMonitor(boolean enableStatusMonitor)
- Parameters:
enableStatusMonitor- the enableStatusMonitor to set
-
setBrokerService
public void setBrokerService(BrokerService brokerService)
This is called by the BrokerService right before it starts the transport.- Specified by:
setBrokerServicein interfaceBrokerServiceAware
-
getBroker
public Broker getBroker()
-
getBrokerService
public BrokerService getBrokerService()
-
isUpdateClusterClients
public boolean isUpdateClusterClients()
- Specified by:
isUpdateClusterClientsin interfaceConnector- Returns:
- the updateClusterClients
-
setUpdateClusterClients
public void setUpdateClusterClients(boolean updateClusterClients)
- Parameters:
updateClusterClients- the updateClusterClients to set
-
isRebalanceClusterClients
public boolean isRebalanceClusterClients()
- Specified by:
isRebalanceClusterClientsin interfaceConnector- Returns:
- the rebalanceClusterClients
-
setRebalanceClusterClients
public void setRebalanceClusterClients(boolean rebalanceClusterClients)
- Parameters:
rebalanceClusterClients- the rebalanceClusterClients to set
-
isUpdateClusterClientsOnRemove
public boolean isUpdateClusterClientsOnRemove()
- Specified by:
isUpdateClusterClientsOnRemovein interfaceConnector- Returns:
- the updateClusterClientsOnRemove
-
setUpdateClusterClientsOnRemove
public void setUpdateClusterClientsOnRemove(boolean updateClusterClientsOnRemove)
- Parameters:
updateClusterClientsOnRemove- the updateClusterClientsOnRemove to set
-
getUpdateClusterFilter
public String getUpdateClusterFilter()
- Specified by:
getUpdateClusterFilterin interfaceConnector- Returns:
- the updateClusterFilter
-
setUpdateClusterFilter
public void setUpdateClusterFilter(String updateClusterFilter)
- Parameters:
updateClusterFilter- the updateClusterFilter to set
-
connectionCount
public int connectionCount()
- Specified by:
connectionCountin interfaceConnector
-
isAllowLinkStealing
public boolean isAllowLinkStealing()
Description copied from interface:ConnectorIf enabled, older connections with the same clientID are stopped- Specified by:
isAllowLinkStealingin interfaceConnector- Returns:
- true/false if link stealing is enabled
-
setAllowLinkStealing
public void setAllowLinkStealing(boolean allowLinkStealing)
-
isAuditNetworkProducers
public boolean isAuditNetworkProducers()
-
setAuditNetworkProducers
public void setAuditNetworkProducers(boolean auditNetworkProducers)
Enable a producer audit on network connections, Traps the case of a missing send reply and resend. Note: does not work with conduit=false, networked composite destinations or networked virtual topics- Parameters:
auditNetworkProducers-
-
getMaximumProducersAllowedPerConnection
public int getMaximumProducersAllowedPerConnection()
-
setMaximumProducersAllowedPerConnection
public void setMaximumProducersAllowedPerConnection(int maximumProducersAllowedPerConnection)
-
getMaximumConsumersAllowedPerConnection
public int getMaximumConsumersAllowedPerConnection()
-
setMaximumConsumersAllowedPerConnection
public void setMaximumConsumersAllowedPerConnection(int maximumConsumersAllowedPerConnection)
-
getPublishedAddressPolicy
public PublishedAddressPolicy getPublishedAddressPolicy()
Gets the currently configured policy for creating the published connection address of this TransportConnector.- Returns:
- the publishedAddressPolicy
-
setPublishedAddressPolicy
public void setPublishedAddressPolicy(PublishedAddressPolicy publishedAddressPolicy)
Sets the configured policy for creating the published connection address of this TransportConnector.
-
isWarnOnRemoteClose
public boolean isWarnOnRemoteClose()
-
setWarnOnRemoteClose
public void setWarnOnRemoteClose(boolean warnOnRemoteClose)
-
isDisplayStackTrace
public boolean isDisplayStackTrace()
-
setDisplayStackTrace
public void setDisplayStackTrace(boolean displayStackTrace)
-
-