ActiveMQ JMS input event adapter is an internal event adapter that comes with WSO2 products by default. You can configure it with XML, map, JSON, and text input mapping types.
Prerequisites
Follow the steps below to set up the prerequisites before starting the configuration.
Install Apache ActiveMQ JMS.
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.
- Add the following ActiveMQ JMS-specific JAR files to
<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
- Start the ActiveMQ JMS server.
Creating an ActiveMQ JMS input event adapter
You can create an ActiveMQ JMS input event adapter either using the management console or using a configuration file as explained below.
Creating using the management console
For instructions on creating an ActiveMQ JMS input event adapter using the management console, see Receiving Events.
Specify the Adapter Properties, when creating an ActiveMQ JMS input event adapter using the management console as shown below.
The above adapter properties are described below.
Adapter Property | Description | Example |
---|---|---|
Topic/Queue Name | A string of characters to denote a valid name of a JMS topic to subscribe to, or named queue to use when WSO2 CEP sends and receives messages. | Test Topic |
JNDI Initial Context Factory Class | JNDI initial context factory class. The class must implement the | org.apache.activemq.jndi.ActiveMQInitialContextFactory |
JNDI Provider URL | URL of the JNDI provider. | tcp://localhost:61616 |
The JMS connection password | A valid password for the JMS connection. | ******* |
The JMS connection username | A valid username for the JMS connection. | jms_user |
Connection Factory JNDI Name | The JNDI name of the connection factory. | TopicConnectionFactory |
Destination Type | The sort order for messages that arrive on a specific destination. | topic/queue |
Enable Durable Subscription | Whether the subscription is durable or not. | true/false |
Durable Subscriber Name | A string of characters to denote a valid name of the durable subscriber. (It enables durable subscription if you add any value here). | subscriber |
JMS Properties | Valid property and value pairs to denote Axis2 JMS properties (e.g. "property1: value1, property2: value2") For more information on JMS properties, go to Apache AXIS2 Transports Documentation. | SessionTransacted:false |
After entering the above adapter properties, select the Event Stream to which you want to map the incoming events, and the Message Format which you want to apply on the receiving events. Also, click Advanced to define custom input mappings based on the Message Format you selected. For more information on custom input mapping types, see Receiving Events in Various Event Formats.
Creating using a configuration file
For instructions on creating an ActiveMQ JMS input event adapter using a configuration file, see Receiving Events.
Use the following configuration file to create an ActiveMQ JMS input event adapter. An event receiver implementation must start with <eventReceiver
as the root element.>
<eventReceiver name="ActiveMQJMSInputEventAdapter" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventreceiver"> <from 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.DestinationType">topic</property> <property name="transport.jms.SubscriptionDurable">false</property> <property name="transport.jms.Destination">test_topic</property> <property name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</property> </from> <mapping customMapping="disable" type="xml"/> <to streamName="Test Stream" version="1.0.0"/> </eventReceiver>
The properties of the above configuration are described below.
Adapter property | Description |
---|---|
name | Name of the ActiveMQ JMS input event adapter |
statistics | Whether monitoring event statistics is enabled for the receiver |
trace | Whether tracing events is enabled for the receiver |
xmlns | XML namespace for event receivers |
eventAdapterType | Type of the event adapter. |
java.naming.factory.initial | JNDI initial context factory class. The class must implement the java.naming.spi.InitialContextFactory interface. |
java.naming.provider.url | URL of the JNDI provider. |
transport.jms.DestinationType | The sort order for messages that arrive on a specific destination. |
transport.jms.SubscriptionDurable | Whether the subscription is durable or not. |
transport.jms.Destination | A string of characters to denote a valid name of a JMS topic to subscribe to, or named queue to use when WSO2 CEP sends and receives messages. |
transport.jms.ConnectionFactoryJNDIName | The JNDI name of the connection factory. |
customMapping | Whether a custom mapping is enabled on the receiver. |
type | Type of the enabled custom mapping. |
streamName | Name if the event stream to which the receiver is mapped. |