Class TransportConfiguration

  • All Implemented Interfaces:
    java.io.Serializable

    public class TransportConfiguration
    extends java.lang.Object
    implements java.io.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
    • Constructor Summary

      Constructors 
      Constructor Description
      TransportConfiguration()
      Creates a default TransportConfiguration with no configured transport.
      TransportConfiguration​(java.lang.String className)
      Creates a TransportConfiguration providing the class name of the ConnectorFactory
      TransportConfiguration​(java.lang.String className, java.util.Map<java.lang.String,​java.lang.Object> params)
      Creates a TransportConfiguration providing the class name of the ConnectorFactory and any parameters needed.
      TransportConfiguration​(java.lang.String className, java.util.Map<java.lang.String,​java.lang.Object> params, java.lang.String name)
      Creates a TransportConfiguration with a specific name providing the class name of the ConnectorFactory and any parameters needed.
      TransportConfiguration​(java.lang.String className, java.util.Map<java.lang.String,​java.lang.Object> params, java.lang.String name, java.util.Map<java.lang.String,​java.lang.Object> extraProps)
      Creates a TransportConfiguration with a specific name providing the class name of the ConnectorFactory and any parameters needed.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void decode​(org.apache.activemq.artemis.api.core.ActiveMQBuffer buffer)
      Decodes this TransportConfiguration from a buffer.
      void encode​(org.apache.activemq.artemis.api.core.ActiveMQBuffer buffer)
      Encodes this TransportConfiguration into a buffer.
      boolean equals​(java.lang.Object o)  
      java.util.Map<java.lang.String,​java.lang.Object> getCombinedParams()  
      java.util.Map<java.lang.String,​java.lang.Object> getExtraParams()  
      java.lang.String getFactoryClassName()
      Returns the class name of ConnectorFactory being used by this TransportConfiguration
      java.lang.String getName()
      Returns the name of this TransportConfiguration.
      java.util.Map<java.lang.String,​java.lang.Object> getParams()
      Returns any parameters set for this TransportConfiguration
      int 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 acceptor
      boolean isSameParams​(TransportConfiguration that)  
      TransportConfiguration newTransportConfig​(java.lang.String newName)  
      void setFactoryClassName​(java.lang.String factoryClassName)  
      void setName​(java.lang.String name)  
      static java.lang.String[] splitHosts​(java.lang.String commaSeparatedHosts)
      Utility method for splitting a comma separated list of hosts
      org.apache.activemq.artemis.json.JsonObject toJson()  
      java.lang.String toString()  
      static java.lang.String toStringParameters​(java.util.Map<java.lang.String,​java.lang.Object> params, java.util.Map<java.lang.String,​java.lang.Object> extraProps)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • EXTRA_PROPERTY_PREFIX

        public static final java.lang.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​(java.lang.String className,
                                      java.util.Map<java.lang.String,​java.lang.Object> params,
                                      java.lang.String name)
        Creates a TransportConfiguration with a specific name providing the class name of the ConnectorFactory and any parameters needed.
        Parameters:
        className - The class name of the ConnectorFactory
        params - The parameters needed by the ConnectorFactory
        name - The name of this TransportConfiguration
      • TransportConfiguration

        public TransportConfiguration​(java.lang.String className,
                                      java.util.Map<java.lang.String,​java.lang.Object> params,
                                      java.lang.String name,
                                      java.util.Map<java.lang.String,​java.lang.Object> extraProps)
        Creates a TransportConfiguration with a specific name providing the class name of the ConnectorFactory and any parameters needed.
        Parameters:
        className - The class name of the ConnectorFactory
        params - The parameters needed by the ConnectorFactory
        name - The name of this TransportConfiguration
        extraProps - The extra properties that specific to protocols
      • TransportConfiguration

        public TransportConfiguration​(java.lang.String className,
                                      java.util.Map<java.lang.String,​java.lang.Object> params)
        Creates a TransportConfiguration providing the class name of the ConnectorFactory and any parameters needed.
        Parameters:
        className - The class name of the ConnectorFactory
        params - The parameters needed by the ConnectorFactory
      • TransportConfiguration

        public TransportConfiguration​(java.lang.String className)
        Creates a TransportConfiguration providing the class name of the ConnectorFactory
        Parameters:
        className - The class name of the ConnectorFactory
    • Method Detail

      • toJson

        public org.apache.activemq.artemis.json.JsonObject toJson()
      • splitHosts

        public static java.lang.String[] splitHosts​(java.lang.String commaSeparatedHosts)
        Utility method for splitting a comma separated list of hosts
        Parameters:
        commaSeparatedHosts - the comma separated host string
        Returns:
        the hosts
      • getName

        public java.lang.String getName()
        Returns the name of this TransportConfiguration.
        Returns:
        the name
      • setName

        public void setName​(java.lang.String name)
      • getFactoryClassName

        public java.lang.String getFactoryClassName()
        Returns the class name of ConnectorFactory being used by this TransportConfiguration
        Returns:
        The factory's class name
      • getParams

        public java.util.Map<java.lang.String,​java.lang.Object> getParams()
        Returns any parameters set for this TransportConfiguration
        Returns:
        the parameters
      • getExtraParams

        public java.util.Map<java.lang.String,​java.lang.Object> getExtraParams()
      • getCombinedParams

        public java.util.Map<java.lang.String,​java.lang.Object> getCombinedParams()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • 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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toStringParameters

        public static java.lang.String toStringParameters​(java.util.Map<java.lang.String,​java.lang.Object> params,
                                                          java.util.Map<java.lang.String,​java.lang.Object> extraProps)
      • encode

        public void encode​(org.apache.activemq.artemis.api.core.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​(org.apache.activemq.artemis.api.core.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​(java.lang.String factoryClassName)