Class TransportConfiguration
- java.lang.Object
-
- org.apache.activemq.artemis.api.core.TransportConfiguration
-
- All Implemented Interfaces:
Serializable
public class TransportConfiguration extends Object implements Serializable
A TransportConfiguration is used by a client to specify connections to a server and its backup if one exists.Typically the constructors take the class name and parameters for needed to create the connection. These will be different dependent on which connector is being used, i.e. Netty or InVM etc. For example:
HashMap<String, Object> map = new HashMap<String, Object>(); map.put("host", "localhost"); map.put("port", 61616); TransportConfiguration config = new TransportConfiguration(InVMConnectorFactory.class.getName(), map); ClientSessionFactory sf = new ClientSessionFactoryImpl(config);
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXTRA_PROPERTY_PREFIX
static String
NAME_PARAM
-
Constructor Summary
Constructors Constructor Description TransportConfiguration()
Creates a default TransportConfiguration with no configured transport.TransportConfiguration(String className)
Creates a TransportConfiguration providing the class name of theConnectorFactory
TransportConfiguration(String className, Map<String,Object> params)
Creates a TransportConfiguration providing the class name of theConnectorFactory
and any parameters needed.TransportConfiguration(String className, Map<String,Object> params, String name)
Creates a TransportConfiguration with a specific name providing the class name of theConnectorFactory
and any parameters needed.TransportConfiguration(String className, Map<String,Object> params, String name, Map<String,Object> extraProps)
Creates a TransportConfiguration with a specific name providing the class name of theConnectorFactory
and any parameters needed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
decode(ActiveMQBuffer buffer)
Decodes this TransportConfiguration from a buffer.void
encode(ActiveMQBuffer buffer)
Encodes this TransportConfiguration into a buffer.boolean
equals(Object o)
Map<String,Object>
getCombinedParams()
Map<String,Object>
getExtraParams()
String
getFactoryClassName()
Returns the class name of ConnectorFactory being used by this TransportConfigurationString
getName()
Returns the name of this TransportConfiguration.Map<String,Object>
getParams()
Returns any parameters set for this TransportConfigurationint
hashCode()
boolean
isEquivalent(TransportConfiguration otherConfig)
There's a case on ClusterConnections that we need to find an equivalent Connector and we can't use a Netty Cluster Connection on an InVM ClusterConnection (inVM used on tests) for that reason I need to test if the two instances of the TransportConfiguration are equivalent while a test a connector against an acceptorboolean
isSameParams(TransportConfiguration that)
TransportConfiguration
newTransportConfig(String newName)
void
setFactoryClassName(String factoryClassName)
void
setName(String name)
static String[]
splitHosts(String commaSeparatedHosts)
Utility method for splitting a comma separated list of hostsorg.apache.activemq.artemis.json.JsonObject
toJson()
String
toString()
static String
toStringParameters(Map<String,Object> params, Map<String,Object> extraProps)
-
-
-
Field Detail
-
NAME_PARAM
public static final String NAME_PARAM
- See Also:
- Constant Field Values
-
EXTRA_PROPERTY_PREFIX
public static final String EXTRA_PROPERTY_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TransportConfiguration
public TransportConfiguration()
Creates a default TransportConfiguration with no configured transport.
-
TransportConfiguration
public TransportConfiguration(String className, Map<String,Object> params, String name)
Creates a TransportConfiguration with a specific name providing the class name of theConnectorFactory
and any parameters needed.- Parameters:
className
- The class name of the ConnectorFactoryparams
- The parameters needed by the ConnectorFactoryname
- The name of this TransportConfiguration
-
TransportConfiguration
public TransportConfiguration(String className, Map<String,Object> params, String name, Map<String,Object> extraProps)
Creates a TransportConfiguration with a specific name providing the class name of theConnectorFactory
and any parameters needed.- Parameters:
className
- The class name of the ConnectorFactoryparams
- The parameters needed by the ConnectorFactoryname
- The name of this TransportConfigurationextraProps
- The extra properties that specific to protocols
-
TransportConfiguration
public TransportConfiguration(String className, Map<String,Object> params)
Creates a TransportConfiguration providing the class name of theConnectorFactory
and any parameters needed.- Parameters:
className
- The class name of the ConnectorFactoryparams
- The parameters needed by the ConnectorFactory
-
TransportConfiguration
public TransportConfiguration(String className)
Creates a TransportConfiguration providing the class name of theConnectorFactory
- Parameters:
className
- The class name of the ConnectorFactory
-
-
Method Detail
-
toJson
public org.apache.activemq.artemis.json.JsonObject toJson()
-
splitHosts
public static String[] splitHosts(String commaSeparatedHosts)
Utility method for splitting a comma separated list of hosts- Parameters:
commaSeparatedHosts
- the comma separated host string- Returns:
- the hosts
-
newTransportConfig
public TransportConfiguration newTransportConfig(String newName)
-
getName
public String getName()
Returns the name of this TransportConfiguration.- Returns:
- the name
-
setName
public void setName(String name)
-
getFactoryClassName
public String getFactoryClassName()
Returns the class name of ConnectorFactory being used by this TransportConfiguration- Returns:
- The factory's class name
-
getParams
public Map<String,Object> getParams()
Returns any parameters set for this TransportConfiguration- Returns:
- the parameters
-
isSameParams
public boolean isSameParams(TransportConfiguration that)
-
isEquivalent
public boolean isEquivalent(TransportConfiguration otherConfig)
There's a case on ClusterConnections that we need to find an equivalent Connector and we can't use a Netty Cluster Connection on an InVM ClusterConnection (inVM used on tests) for that reason I need to test if the two instances of the TransportConfiguration are equivalent while a test a connector against an acceptor- Parameters:
otherConfig
-- Returns:
true
if the factory class names are equivalents
-
toStringParameters
public static String toStringParameters(Map<String,Object> params, Map<String,Object> extraProps)
-
encode
public void encode(ActiveMQBuffer buffer)
Encodes this TransportConfiguration into a buffer.Note that this is only used internally ActiveMQ Artemis.
- Parameters:
buffer
- the buffer to encode into
-
decode
public void decode(ActiveMQBuffer buffer)
Decodes this TransportConfiguration from a buffer.Note this is only used internally by ActiveMQ
- Parameters:
buffer
- the buffer to decode from
-
setFactoryClassName
public void setFactoryClassName(String factoryClassName)
-
-