This documentation is for WSO2 API Manager 2.5.0 View documentation for the latest release.
Configuring Admin App Event Publishing for Traffic Manager HA Setup - API Manager 2.5.0 - WSO2 Documentation

All docs This doc
||
Skip to end of metadata
Go to start of metadata

The Admin App, which is accessed via the Admin Portal (https://<APIM-host>:<APIM-port>/admin) is generally setup in the Publisher node when WSO2 API Manager (WSO2 API-M) is deployed in a distributed setup.

When the Traffic Manager (TM) is set up for high availability (HA), you need to configure the Admin App to publish events to the blockingData topic in a failover manner to enable event publishing in the Admin App. When the blockingData topic receives the message from the Admin App, it publishes the messages to the throttleData topics in both the Traffic Managers, and the Gateways receive the messages from throttleData topics.

If there is a failure in Traffic Manager 1 (TM1), the Admin App starts publishing to the blockingData event in the other Traffic Manager (blockingData2). When TM1 is restored, blockingData2 publishes the latest events to throttleData1. As a result, the Gateways that are connected to TM1 always receive the latest changes with regard to the blacklist conditions.

Furthermore, as illustrated in the diagram below a JMS receiver listens to the blockingData topic. When the JMS receiver receives an event, it sends it through an event stream and publishes it through the attached JMS publishers to the throttleData topics.

Follow the instructions below to configure Admin App event publishing when the Traffic Managers are setup for high availability.

Step 1 - Configure the Admin App

  1. Change the topic name to blockingData in the Event publisher configurations, which is in the <API-M_HOME>/repository/conf/api-manager.xml file.

    api-manager.xml
    <JMSEventPublisherParameters>
       <java.naming.factory.initial>org.wso2.andes.jndi.PropertiesFileInitialContextFactory</java.naming.factory.initial>
       <java.naming.provider.url>repository/conf/jndi.properties</java.naming.provider.url>
       <transport.jms.DestinationType>topic</transport.jms.DestinationType>
       <transport.jms.Destination>blockingData</transport.jms.Destination>
       <transport.jms.ConcurrentPublishers>allow</transport.jms.ConcurrentPublishers>
      <transport.jms.ConnectionFactoryJNDIName>TopicConnectionFactory</transport.jms.ConnectionFactoryJNDIName>
    </JMSEventPublisherParameters>
  2. Configure the blockingData topic in the <API-M_HOME>/repository/conf/jndi.properties file.

    jndi.properties
    connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientID/carbon?failover='roundrobin'%26cyclecount='2'%26brokerlist='tcp://127.0.0.1:5674?retries='5'%26connectdelay='50';tcp://127.0.0.1:5675?retries='5'%26connectdelay='50''
    topic.blockingData = blockingData

Step 2 - Configure the Traffic Manager nodes

You need to carry out the following configurations in both the Traffic Manager nodes in order to send the JMS messages from the blockingData topic to the throttleData topics.

  1. Add a JMS receiver.
    Create a file named blockingEventReceiver.xml with the following content, and move it to the <API-M_HOME>/repository/deployment/server/eventreceivers directory, to add a new event receiver. 

    blockingEventReceiver.xml
    <eventReceiver xmlns="http://wso2.org/carbon/eventreceiver" name="blockingEventReceiver" statistics="enable" trace="enable">
       <from eventAdapterType="jms">
          <property name="transport.jms.DestinationType">topic</property>
          <property name="transport.jms.Destination">blockingData</property>
          <property name="java.naming.factory.initial">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</property>
          <property name="java.naming.provider.url">repository/conf/jndi2.properties</property>
          <property name="transport.jms.SubscriptionDurable">false</property>
          <property name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</property>
       </from>
       <mapping customMapping="disable" type="map" />
       <to streamName="org.wso2.blocking.condition.stream" version="1.0.0" />
    </eventReceiver>
  2. Configure the blocking event receiver.
    Create a file named jndi2.properties in the <API-M_HOME>/repository/conf directory with the following content.

    jndi2.properties
    connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientid/carbon?brokerlist='tcp://localhost:5674'
    connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/test?brokerlist='tcp://localhost:5674'
    topic.blockingData = blockingData

    Changing the admin password

    To change the admin password go to Changing the super admin password. See the note given under step 2 for instructions to follow if your password has special characters.


    You need to add this configuration so that the JMS receiver namely blockingEventReceiver can listen to the local blockingData topic.

  3. Add an event stream.
    Create a file named org.wso2.blocking.condition.stream_1.0.0.json in the <API-M_HOME>/repository/deployment/server/eventstreams directory.

    org.wso2.blocking.condition.stream_1.0.0.json
    {
      "name": "org.wso2.blocking.condition.stream",
      "version": "1.0.0",
      "nickName": "",
      "description": "",
      "payloadData": [
        {
          "name": "blockingCondition",
          "type": "STRING"
        },
        {
          "name": "conditionValue",
          "type": "STRING"
        },
        {
          "name": "state",
          "type": "STRING"
        },
        {
          "name": "tenantDomain",
          "type": "STRING"
        },
        {
          "name": "keyTemplateValue",
          "type": "STRING"
        },
        {
          "name": "keyTemplateState",
          "type": "STRING"
        }
      ]
    }
  4. Add JMS publishers to publish blocking data.

    1. Add a JMS publisher to publish events from blockingData1 to throttleData1.
      Create a file named blockingconditionpubblisher1.xml in the <API-M_HOME>/repository/deployment/server/eventpublishers directory, to add an event publisher.

      blockingconditionpubblisher1.xml
      <eventPublisher xmlns="http://wso2.org/carbon/eventpublisher" name="blockingconditionpubblisher1" processing="enable" statistics="disable" trace="enable">
         <from streamName="org.wso2.blocking.condition.stream" version="1.0.0" />
         <mapping customMapping="disable" type="map" />
         <to eventAdapterType="jms">
            <property name="transport.jms.DestinationType">topic</property>
            <property name="transport.jms.Destination">throttleData</property>
            <property name="transport.jms.ConcurrentPublishers">allow</property>
            <property name="java.naming.factory.initial">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</property>
            <property name="java.naming.provider.url">repository/conf/jndi.properties</property>
            <property name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</property>
         </to>
      </eventPublisher>
    2. Add a JMS publisher to publish events from blockingData1 to throttleData2.
      Create a file named blockingconditionpubblisher2.xml in the <API-M_HOME>/repository/deployment/server/eventpublishers directory, to add another event publisher.

      blockingconditionpubblisher2.xml
      <eventPublisher xmlns="http://wso2.org/carbon/eventpublisher" name="blockingconditionpubblisher2" processing="enable" statistics="disable" trace="enable">
         <from streamName="org.wso2.blocking.condition.stream" version="1.0.0" />
         <mapping customMapping="disable" type="map" />
         <to eventAdapterType="jms">
            <property name="transport.jms.DestinationType">topic</property>
            <property name="transport.jms.Destination">throttleData</property>
            <property name="transport.jms.ConcurrentPublishers">allow</property>
            <property name="java.naming.factory.initial">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</property>
            <property name="java.naming.provider.url">repository/conf/jndi3.properties</property>
            <property name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</property>
         </to>
      </eventPublisher>
      • Make sure that you add the correct JNDI configurations to point to the correct message topic.

      • You need to carry out all the Traffic Manger related configurations mentioned in step 2 in the other Traffic Manager node (TM2) as well.

  • No labels