Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Changing the Default Port of WSO2 Message Broker

AsLike other WSO2 products, Message Broker also uses the 9443 port 9443 in the default configuration. However, there can be incidents instances where this default port needs to be changed. In order to do so it is needed to To start MB in a different port, change the <Offset> entry in the <MB_HOME>/repository/conf/carbon.xml file.

The following block handles the port configurations in the carbon.xml file.

As it is explained in the comment block in the <Offset> entry, by changing the value in the <Offset>, Message Broker can be started in a different port.

:

Code Block
languagehtml/xml
<Ports>
        <!-- Ports offset. This entry will set the value of the ports defined below to
         the define value + Offset.
         e.g. Offset=2 and HTTPS port=9443 will set the effective HTTPS port to 9445
         -->
        <Offset>0</Offset>
        <!-- The JMX Ports -->
        <JMX>
            <!--The port RMI registry is exposed-->
            <RMIRegistryPort>9999</RMIRegistryPort>
            <!--The port RMI server should be exposed-->
            <RMIServerPort>11111</RMIServerPort>
        </JMX>
        <!-- Embedded LDAP server specific ports -->
        <EmbeddedLDAP>
            <!-- Port which embedded LDAP server runs -->
            <LDAPServerPort>10389</LDAPServerPort>
            <!-- Port which KDC (Kerberos Key Distribution Center) server runs -->
            <KDCServerPort>8000</KDCServerPort>
        </EmbeddedLDAP>
    
        <!-- Embedded Qpid broker ports -->
        <EmbeddedQpid>
        <!-- Broker TCP Port -->
            <BrokerPort>5672</BrokerPort>
        <!-- SSL Port -->
            <BrokerSSLPort>8672</BrokerSSLPort>
        </EmbeddedQpid>
    
    <!-- 
             Override datasources JNDIproviderPort defined in bps.xml and datasources.properties files
    -->
    <!--<JNDIProviderPort>2199</JNDIProviderPort>-->
    <!--Override receive port of thrift based entitlement service.-->
    <ThriftEntitlementReceivePort>10500</ThriftEntitlementReceivePort>
    </Ports>

In addition to this, as the Message Broker's port offset is changed by above, it is also needed to change the  default Cassandra port accordingly by opening If you are using an external Cassandra server and changed the default port as mentioned above, then you also need to change the <connectionString> entry in the <MB_HOME>/repository/conf/advanced/qpid-virtualhosts file to point to the same Cassandra server mentioned in the carbon.xml file. For an example if the <Offset> is changed  by 2, the <connectionString> entry of Cassandra must be changed as ' localhost:9162 ' as shown below.

Code Block
languagehtml/xml
<store>
     <class>org.wso2.andes.server.store.CassandraMessageStore</class>
     <username>admin</username>
     <password>admin</password>
     <cluster>ClusterOne</cluster>
     <idGenerator>org.wso2.andes.server.cluster.coordination.TimeStampBasedMessageIdGenerator</idGenerator>
     <connectionString>localhost:9162<<connectionString>192.168.0.100:9160</connectionString>
 <</store>

 

Configuring a Client to Access Broker When Port Offset is Changed

As the Message Broker's port offset is changedthe default TCP Port of the broker also gets increased by the value set as the port offset. Hence when using an external client to connect with the broker, TCP connection url's port should be changed to reflect the port offset value's change.

Therefore if <Offset> is set as '1' , the TCP Connection URL which is in the form of " amqp://{username}:{password}@carbon/carbon?brokerlist='tcp://{hostname}:{port} '" must be changed to "amqp://{username}:{password}@carbon/carbon?brokerlist='tcp://{hostname}:{port+1}" from this onwards.

As default Broker TCP Port value is 5672 in this case it must be changed into 5673.