||
Skip to end of metadata
Go to start of metadata

The RabbitMQ is an event receiver to receive messages from RabbitMQ Broker that match a specified configuration. You can configure it with XML, JSON, and Text input mapping types.

Creating a RabbitMQ event receiver

For instructions to create a RabbitMQ event receiver, see Configuring receiver properties.

Configuring  receiver properties

A RabbitMQ event receiver can be configured in the Management Console as shown below. To open the following page,click Main => Manage => Receiver to open the Available Receivers page and then click Add Event Receiver.

The properties configured above are described in the table below.

Adapter property
Description
Configuration file property
Example

Host Name

The host name of the server.
hostName
localhost
Host Port  The port of the server.
port
5672

Username 

A valid user name for the broker connection.
username
guest

Password 

A valid password for the broker connection.

password
guest
Queue Name  

The name of the queue. A queue is a buffer that stores messages.

queue.Name
queue

Exchange Name

The name of the exchange. The exchange provides the logic to handle messages received by the RabbitMQ event receiver.

exchange.Name
exchange
Enable Queue DurableThis specifies whether the queue should remain declared even if the broker restarts.
queue.Durable
true/false

Enable Queue Exclusive

This specifies whether the queue should be exclusive to one connection or whether it should be consumable by other connections.

queue.Exclusive
true/false

Enable Queue Auto Delete

This specifies whether the queue should be kept even if it is not being consumed anymore.

queue.Autodelete
true/false

Enable Queue Auto Ack

This specifies whether an acknowledgement should be sent back for the messages received.

queue.Autoack
true/false

Queue Routing Key

The routing key is referred to by the exchange in order to determine how messages should be routed to queues. The routing key is similar to the address for a message.

queue.RoutingKey
queue

Consumer Tag

This specifies the identifier for the consumer. The consumer tag is local to a channel. Therefore, two or more clients can use the same consumer tag. If consumer tag is specified, the server generates a unique tag.

consumer.tag
myConsumerTag

Exchange Type

The type of the exchange.

exchange.Type
direct

Enable Exchange Durable

This specifies whether the exchange should remain declared even if the broker restarts.

exchange.Durable
true/false

Enable Exchange Auto Delete

This specifies whether the queue should be kept even if it is not used anymore.

exchange.Autodelete
true/false

Retry Count

The number of times the CEP receiver should retry connecting to the RabbitMQ broker.
connection.RetryCount
3

Retry Interval 

The number of milliseconds within which the CEP receiver should retry connecting to the RabbitMQ broker.

connection.RetryInterval
30000

Virtual Host

The virtual host used. The virtual host provides a way to segregate applications using the same RabbitMQ instance.

server.VirtualHost
/virtualhost

Factory Heartbeat

The number of milliseconds after which an inactive connection is considered dead. The connection is removed after the specified amount of time. This ensures that the resources are not wasted on inactive connections.

factory.Heartbeat
60

SSL Enabled

This specifies whether an encrypted communication channel should be established or not.

connection.sslEnabled
true/false

SSL Keystore Location

The location of the root certificate. This certificate is used for SSL (Secure Sockets Layer) encryption.

connection.ssl.keystore.Location../client/keycert.p12

SSL Keystore Type

The type of the keystore.

connection.ssl.keystore.Type
PKCS12

SSL Keystore Password

The password of the keystore.

connection.ssl.keystore.Password
MySecretPassword

SSL Truststore Location

The location of the truststore.  A truststore contains certificates from other parties that you expect to communicate with, or from certificate authorities that you trust to identify other parties.

connection.ssl.truststore.Location
../CEPSSL/rabbitstore

SSL Truststore Type

The type of the truststore.

connection.ssl.truststore.Type
JKS

SSL Truststore Password

The password of truststore.

connection.ssl.truststore.Password
rabbitstore

Connection SSL Version

The version of the SSL.

connection.ssl.VersionSSL

After entering the above receiver properties, click Advanced and do the following.

  • Select the event stream to which you want to map the incoming events.
  • Select the message format in which the events should be received.
  • Define custom output mappings based on the message format you selected. For more information, see Output Mapping Types.

You can also configure the properties mentioned above based on the transport type within the <from> element of the event receiver configuration in the <CEP_HOME>/repository/deployment/server/eventreceivers directory as shown below.

<eventReceiver name="testmsg" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventreceiver">
    <from eventAdapterType="rabbitmq">
		<property name="transport.rabbitmq.server.HostName">localhost</property>
		<property name="transport.rabbitmq.server.Port">5672</property>
  		<property name="transport.rabbitmq.server.UserName">guest</property>
		<property encrypted="true" name="transport.rabbitmq.server.Password">guest</property>
        <property name="transport.rabbitmq.queue.Name">msgqueue</property>
        <property name="transport.rabbitmq.queue.Durable">true</property>
        <property name="transport.rabbitmq.exchange.Name">msgexchange</property>
        <property name="transport.rabbitmq.connection.sslEnabled">false</property>
        <property name="transport.rabbitmq.queue.Autoack">true</property>
        <property name="transport.rabbitmq.exchange.Autodelete">false</property>
        <property name="transport.rabbitmq.exchange.Durable">true</property>
        <property name="transport.rabbitmq.queue.Autodelete">false</property>
        <property name="transport.rabbitmq.queue.Exclusive">false</property>
    </from>
    <mapping customMapping="disable" type="xml"/>
    <to streamName="org.wso2.event.sensor.stream" version="1.0.0"/>
</eventReceiver>
      

 

2797
2798
2799
3125
1012
1027
1648
2041
1826
1830
1915
1978
  • No labels