Versions Compared

Key

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

ActiveMQ JMS output event adapter can be is used to publish events having in map, XML, JSON, and text formats via jms JMS transport.

Table of Contents
maxLevel3

Prerequisites

Follow the steps below to set up the prerequisites before starting the configuration.

  1. Install Apache ActiveMQ JMS. 

     

    Icon
    Info

    This guide uses ActiveMQ versions 5.7.0 or below. If you want to use a later version, for instructions on the necessary changes to the configuration steps, go to Apache ActiveMQ Documentation.

  2. Add the following ActiveMQ JMS-specific JAR files to  <PRODUCT  the <CEP_HOME>/repository/components/lib/ directory. 
    • <ACTIVEMQ_HOME>/lib/activemq-core-xxx.jar  
    • <ACTIVEMQ_HOME>/lib/geronimo-j2ee-management_1.1_spec-1.0.1.jar
  3. Refer the <PRODUCTthe <CEP_HOME>/repository/conf/jndi.properties file to properties file to register a connection factory. For example, if the connection factory JNDI name is "TopicConnectionFactory", it will point the default ActiveMQ host to localhost and port to 5672 as shown below. Furthermore, add the topics to be sent to the ActiveMQ broker in the format: topic.{topicName} = {topicName}

    Code Block
    languagetext
    connectionfactory.TopicConnectionFactory=amqp://admin:admin@clientid/test?brokerlist='tcp://localhost:5672'
    
    topic.topicMap = topicMap

    
    topic.topicText = topicText
  4. Start ActiveMQ, and then start the product.

Creating an ActiveMQ JMS output event adapter

For instructions on creating an ActiveMQ JMS output event adapter, see Publishing Events.  

Configuring

...

adapter properties

Specify the Static and Dynamic ActiveMQ JMS output event adapter requires following adapter configurations;Adapter Properties, when creating an ActiveMQ JMS output event adapter using the management console as shown below.

ActiveMQ JMS PublisherImage Added

Info

After entering the above adapter properties, select the Message Format which you want to apply on the published events. Also, click Advanced to define custom output mappings based on the Message Format you selected. For more information on custom output mapping types, see Publishing Events in Various Event Formats.

You can also define the respective adapter properties of the event publisher based on the transport type within the <to> element of the event publisher configuration in the <CEP_HOME>/repository/deployment/server/eventpublishers/ directory as follows.

Code Block
languagexml
<eventPublisher name="ActiveMQJMSOutputEventAdapter" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
  .................
  <to eventAdapterType="jms">
    <property name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</property>
    <property name="java.naming.provider.url">tcp://localhost:61616</property>
    <property name="transport.jms.UserName">jms-user</property>
    <property encrypted="true" name="transport.jms.Password">ImE/+i4TR0c7p97CWbd8bUgfXfC8XcKWVwIwXxw+ROUFvxOR3+61S6YXqZK7dkKTLgBBFNmB2czfSiJrUz9jCYxFXSUquCfqFs8UKXx3976sjmM+giTTyPJnyCNilceF2fMPZ0abOJdq7gD+zi9IeoX14EPnZUuY9sOUOGFg7B8=</property>
    <property name="transport.jms.DestinationType">topic</property>
    <property name="transport.jms.Header">header_name1:header_value1,header_name2:header_value2</property>
    <property name="transport.jms.Destination">topicMap</property>
    <property name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</property>
  </to>
</eventPublisher>

The above adapter properties are described below.

Static Adapter Properties 

Adapter Property
Possible Values
Default
DescriptionDescription
Configuration file propertyExample
JNDI Initial Context Factory Classorg.apache.activemq.jndi.ActiveMQInitialContextFactory The JNDI initial context factory class. The class must implement the java.naming.spi.InitialContextFactory interface
java.naming.factory.initial
org.apache.activemq.jndi.ActiveMQInitialContextFactory
JNDI Provider URLURL of the JNDI provider
java.naming.provider.url
tcp://localhost:61616 URL of the JNDI provider.
UsernameA valid Valid username for the JMS connection Set a username for the JMS connection.
transport.jms.UserName
jms-user
PasswordA valid Valid password for the JMS connection Set a password for the JMS connection.
transport.jms.Password
jms-password
Connection Factory JNDI NameTopicConnectionFactory The JNDI name of the connection factory
transport.jms.ConnectionFactoryJNDIName
TopicConnectionFactory
Destination Type

topic/queue

topic

Define the The sort order for messages that arrive on a specific destination
transport.jms.DestinationType
topic/queue
DestinationtopicMap CEP send messages by publishing to a topic or a queue.The topic or queue to which WSO2 CEP sends messages by publishing.
transport.jms.Destination
topicMap

Dynamic Adapter Properties 

Define Transport Headers
Adapter PropertyPossible ValuesDefaultDescriptionDescriptionConfiguration file propertyExample
HeaderA Define Transport Headers as a valid header name : in a header value pair eg format   transport.jms.Headerheader_name1:header_value1,header_name2:header_value2