This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

WSO2 Message Broker (WSO2 MB) uses two transport protocols for the purpose of brokering messages between publishers and subscribers. These protocols are the Advanced Message Queueing Protocol (AMQP) and the Message Queueing and Telemetry Transport (MQTT).

The topics given below explains how these protocols are enabled and configured for WSO2 MB:

Advanced Message Queuing Protocol (AMQP)

The Advance Message Queueing Protocol (AMQP) is a wire-level messaging protocol used by WSO2 MB for message queueing. The <MB_HOME>/repository/conf/broker.xml file contains parameters related to configuring the AMQP transport. 

Enabling the transport

The transport is enabled by default, as shown in the following extract of the broker.xml file:

<amqp enabled="true">
	<defaultConnection enabled="true" port="5672" />
</amqp>

If the value of this parameter is true, the AMQP transport is enabled and the AMQP protocol will be applied to messages sent to the specified listening port. The default listening port specified for the AMQP transport is 5672. That is, the AMQP broker will be initialized with this port by default.

Configuring the SSL connection

You can configure the secure SSL connection, as shown in the following extract of the broker.xml file:

<amqp enabled="true">
	................
	<sslConnection enabled="true" port="8672">
    	<keyStore>
        	<location>repository/resources/security/wso2carbon.jks</location>
            <password>wso2carbon</password>
            <certType>SunX509</certType>
    	</keyStore>
        <trustStore>
            <location>repository/resources/security/client-truststore.jks</location>
            <password>wso2carbon</password>
            <certType>SunX509</certType>
        </trustStore>
    </sslConnection>
    ............
</amqp>

As shown above,

  • The listening SSL port for the specified AMQP transport is 8672 by default. The AMQP security socket will be initialized with this port by default.
  • The <keyStore> and <trustStore> element specifies the details of the keystore and trustore used. Note that, by default, the keystore configuration points to the default keystore and truststore that is shipped with the product. You

The parameters in the above configuration are as follows.

ParameterDescription
SSL ConnectionThis contains the basic configurations relating to the SSL connection. Setting the

enabled="true" attribute ensures that SSL is enabled by default when the MB server is started. The

port="8672" attribute sets 8672 as the default SSL listener port for messages/command sent via the relevant transport.

Location

The location where the keystore used for securing SSL connections is stored. By default this is the default keystore(wso2carbon.jks) that is shipped with WSO2 MB.

Note that this should always be a keystorecreated for the super tenant. Find out more about setting up keystores for your MB server.

PasswordThe password ofthe keystore.

Related Parameters

Once you have enabled the AMQP transport, you can update the following related parameters as required.

<amqp enabled="true">
	............
    <maximumRedeliveryAttempts>10</maximumRedeliveryAttempts>
    <allowSharedTopicSubscriptions>false</allowSharedTopicSubscriptions>
    <allowStrictNameValidation>true</allowStrictNameValidation>
	............
</amqp>
Parameter NameDescriptionDefault Value
maximumRedeliveryAttemptsThe maximum number of times the WSO2 MB should attempt to redeliver a message that has not reached a subscriber. For example, when this value is set to 10, another 10 attempts will be made to deliver the message. The default value can be changed depending on your reliability requirements.10
allowSharedTopicSubscriptionsIf this parameter is true, a durable subscription to a topic can be shared among multiple subscribers. That is, multiple clients can subscribe to a topic in WSO2 MB using the same client ID. Read more about durable subscriptions to topics.false
allowStrictNameValidation
If this parameter is true, the queue names and topic names will be validated according to the AMQP specification. When this parameter is set to false, it is possible to use ":" in topic names.
true

Refer the description of the broker.xml file for further details.

Message Queueing and Telemetry Transport

The Message Queueing and Telemetry Transport (MQTT) is a lightweight, broker-based publish/subscribe messaging protocol, which enables an extremely lightweight publish/subscribe messaging model. WSO2 MB 3.0.0 and later versions fully support MQTT version 3.1.0, and partially supports version 3.1.1.

The MQTT protocol allows a message to be sent to a topic based on three levels of QoS (Quality of Service) as explained below.

QoS 1 - At Most One - At this level, messages are delivered to subscribers in the most efficient manner. A message is dispatched only once.

QoS 2 - At Least One - At this level, the system will ensure that a message is received by the subscriber at least once. The level of delivery is assured through acknowledged delivery.

QoS 3 - Exactly Once - At this level, the message is delivered only once to its subscriber. This level is also defined as Assured Delivery.

Enabling the transport

The <MB_HOME>/repository/conf/broker.xml file contains parameters related to configuring the MQTT transport. The transport can be enabled as shown in the following extract of the broker.xml file.

<mqtt enabled="true">
	<port>1883</port>
	<sslPort>8883</sslPort> <!-- put proper default ssl port -->
    <inboundBufferSize>32768</inboundBufferSize>
    <deliveryBufferSize>32768</deliveryBufferSize>
    <security>
             <authentication>OPTIONAL</authentication>
             <authenticator>org.wso2.carbon.andes.authentication.andes.CarbonBasedMQTTAuthenticator</authenticator>
    </security>
</mqtt>

Related Parameters

Parameter NameDescriptionDefault Value
enabledIf the value for this parameter is true, the MQTT transport is enabled and the MQTT protocol will be applied to messages that are sent to the specified listening port.true
portThe listening port for the MQTT transport. The MQTT broker will be initialized with the specified port by default. This value would be incremented based on the offset specified in the carbon.xml.1883
sslPortThe listening SSL port for the MQTT transport. The MQTT secure socket will be initialized with the specified port by default.8883

Refer the description of the broker.xml file for further details.

  • No labels