This documentation is for WSO2 Message Broker 3.0.0. View documentation for the latest release.
Due to a known issue do not use JDK1.8.0_151 with WSO2 products. Use JDK 1.8.0_144 until JDK 1.8.0_162-ea is released.
Skip to end of metadata
Go to start of metadata

A tenant specific subscription exists when an external client application subscribes to a queue or a topic that is specific to a particular MB tenant. This section covers the following topics relating to tenant specific subscriptions.

Creating a tenant-specific subscription

When sending or consuming messages to/from this queue/topic using an external client application, or when creating a queue/topic from an external JMS client, the queue/topic name should include the domain prefix. This is further illustrated by the further use case.

Usecase

Subscribe for messages published in a queue named ABCQueue that is specific to the MB tenant abc.com.

Execution steps

WSO2 ESB can be used in this scenario to subscribe to the tenant specific queue named ABCQueue in WSO2 Message Broker.

  1. Set up WSO2 Message Broker as described in Setting up WSO2 Message Broker in the description for integrating WSO2 ESB. Log into the management console in the super tenant mode by using admin as both the user name and password. 
  2. Create a tenant named abc.com in the WSO2 MB management console with the following values. See Managing Tenants for instructions to create tenants.

    ParameterValue
    Domainabc.com
    Select Usage Plan for TenantDemo
    First NameABC
    Last NameDEF
    Admin Usernameabc
    New Admin Passwordabcdef
    Email[email protected]
  3. Download and install WSO2 ESB according to the instructions in Getting Started. The unzipped ESB distribution folder is referred to as ESB_HOME.
  4. Enable the JMS transport of WSO2 ESB to communicate with the Message Broker by editing the <ESB_HOME>/repository/conf/axis2/axis2.xml file. Find a commented <transport receiver> block for MB  and uncomment it as shown below.

    <!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x -->
    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
    …..
      </parameter>
          </transportReceiver>

    Also, uncomment the <transport sender> block for JMS in the same file as shown below.

    <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
  5. Copy the following jar files from the <MB_HOME>/clent-lib folder to the <ESB_HOME>/repository/components/lib folder. 
    • andes-client-0.13.wso2v8
    • geronimo-jms_1.1_spec-1.1.0.wso2v1
     
  6. Open the <ESB_HOME>/repository/conf/JNDI.proerties file. Add a new queue connection factory, a topic connection factory and a queue in it as shown below.

    # register some connection factories
    # connectionfactory.[jndiname] = [ConnectionURL]
    connectionfactory.QueueConnectionFactory = amqp://abc!abc.com:[email protected]/carbon?brokerlist='tcp://localhost:5673'
    connectionfactory.TopicConnectionFactory = amqp://abc!abc.com:[email protected]/carbon?brokerlist='tcp://localhost:5673'
    
    # register some queues in JNDI using the form
    # queue.[jndiName] = [physicalName]
    queue.TestTenantSubs=abc.com/TestTenantSubs

     In this configuration, the user name of the abc.com tenant in the connection factory entries is given as a fully qualified name. The @ symbol is replaced by the ! symbol.

    Since the queue name is prefixed by the tenant domain when it is created in the Message Broker, it is entered in the same way (i.e. abc.com/TestTenantSubsin the JNDI.proerties file.

  7. Create a proxy service named TestTenantSubs with the following configuration in WSO2 ESB. See Working with Proxy Services for further information. This proxy service will serve as a subscriber to the tenant-specific queue that will be automatically created in the MB management console.

    <?xml version="1.0" encoding="UTF-8"?>
    <proxy xmlns="http://ws.apache.org/ns/synapse"
           name="TestTenantSubs"
           transports="jms"
           statistics="disable"
           trace="disable"
           startOnLoad="true">
       <target>
          <inSequence>
             <log level="full"/>
             <property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
             <send>
                <endpoint>
                   <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
                </endpoint>
             </send>
          </inSequence>
       </target>
       <description/>
    </proxy>

Viewing a tenant-specific subscription

This section describes how to view the tenant-specific subscription you created.

  1. Log into the MB management console using the credentials of the tenant you created in the Creating a Tenant-specific subscription section, which are as follows.

    User Name[email protected]
    Passwordabcdef

    A tenant-specific queue/topic can be viewed in the management console only when you are logged in as the relevant tenant.

  2. Click Browse under Queues in the Main tab. The Queue List page will open where the tenant specific queue generated via the subscription made by the TestTenantSubs proxy service is displayed as follows.
  • No labels