Versions Compared

Key

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

Events can be notified or published to external systems from WSO2 servers using event publishers. Event publishers enable you to manage event publishing and notifications. They allow publishing events via multiple transports in JSON, XML, Map, text, and WSO2Event formats to various endpoints and data stores.

Table of Contents
maxLevel3

Configuring global properties

...

Localtabgroup
Localtab
titleRDBMS

When the output event adapter type is RDBMS, it is allowed to change the queries used to perform the standard database operations. This enables you to use RDBMS database types that use different queries. Customised values can be defined for the following used in standard queries.

Attribute/activityCurrent query
stringVARCHAR(255)
doubleDOUBLE
integerINT
longBIGINT
floatFLOAT
createTableCREATE TABLE $TABLE_NAME ($COLUMN_TYPES)
insertDataToTableINSERT INTO $TABLE_NAME ($COLUMNS) VALUES ($VALUES)
isTableExistSELECT * FROM $TABLE_NAME limit 1
updateTableRowUPDATE $TABLE_NAME SET $COLUMN_VALUES WHERE $CONDITION
comma,
questionMark?
equal=
andAND
selectAllColumnsDataTypeInTableSELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$TABLE_NAME'
selectFromTableSELECT $COLUMNS FROM $TABLE_NAME
oracle.stringvarchar2(255)
oracle.longCLOB
oracle.doubleBINARY_DOUBLE
oracle.isTableExistSELECT * FROM $TABLE_NAME WHERE ROWNUM = 1
oracle.selectAllColumnsDataTypeInTableSELECT COLUMN_NAME, DATA_TYPE FROM USER_TAB_COLS WHERE TABLE_NAME = '$TABLE_NAME'
mssql.stringvarchar2(255)
mssql.isTableExistSELECT TOP 1 * FROM $TABLE_NAME
mssql.selectAllColumnsDataTypeInTableSELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$TABLE_NAME'
h2.integervarchar2(255)
h2.longREAL
h2.selectAllColumnsDataTypeInTableSHOW COLUMNS FROM $TABLE_NAME
Localtab
titleHTTP

The following properties are available for the http output event adapter type.

Property KeyDescriptionData TypeDefault Value
minThreadThe minimum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer8
maxThreadThe maximum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer100
keepAliveTimeInMillisThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer20000
jobQueueSizeThe size of the queue that is used to hold events before they are forwarded to the event stream.Integer10000
defaultMaxConnectionsPerHostThe maximum number of connections allowed per host configuration.Integer50
maxTotalConnectionsThe maximum number of connections allowed overall.Integer1000
Localtab
titleJMS

The following properties are available for the jms output event adapter type.

Property KeyDescriptionData TypeDefault Value
minThreadThe minimum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer8
maxThreadThe maximum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer100
keepAliveTimeInMillisThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer20000
jobQueueSizeThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer10000
Localtab
titleMQTT

The following properties are available for the mqtt output event adapter type.

Property KeyDescriptionData TypeDefault Value
minThreadThe minimum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer8
maxThreadThe maximum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer100
keepAliveTimeInMillisThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer20000
jobQueueSizeThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer10000
connectionKeepAliveIntervalThe time interval in milliseconds at which a check should be carried out to identify inactive threads.Integer60
Localtab
titleKAFKA

The following properties are available for the kafka output event adapter type.

Property KeyDescriptionData TypeDefault Value
minThreadThe minimum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer8
maxThreadThe maximum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer100
keepAliveTimeInMillisThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer20000
jobQueueSizeThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer10000
Localtab
titleEmail

The following properties are available for the email output event adapter type.

Property KeyDescriptionData TypeDefault Value
mail.smtp.fromThe email address used by the publisher to publish events.Stringabcd@gmail.com
mail.smtp.userThe username used by the publisher to publish events via email.Stringabcd
mail.smtp.passwordThe password used by the publish events via email.Stringxxxx
mail.smtp.hostThe host of the email server.Stringsmtp.gmail.com
mail.smtp.portThe port of the email server.Integer587
mail.smtp.starttls.enableThis property specifies whether STARTTLS encryption is enabled or not. STARTTLS is an extension which enables a plain text connection to be upgraded to an encrypted (SSL or TLS) connection.Booleantrue
mail.smtp.authThis property specifies whether SMTP authentication is enabled or not.Booleantrue
minThreadThe minimum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer8
maxThreadThe maximum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer100
keepAliveTimeInMillisThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer20000
jobQueueSizeThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer10000
Localtab
titleUI

The following properties are available for the UI output event adapter type.

Property KeyDescriptionData TypeDefault Value
eventQueueSizeThe maximum number of events allowed in the adapter queue when the rate at which a UI publisher receives events to be published higher than the rate at which the relevant UI is accepting the events. When the number of events received by the publisher exceeds the value specified for this property, the publisher stops accepting events until the events that are already in the queue get published. Therefore, if you want to reduce system latency, a higher queue size should be specified.Integer30
minThreadThe minimum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer8
maxThreadThe maximum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer100
keepAliveTimeInMillisThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer20000
jobQueueSizeThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer10000
Localtab
titleWebsocket-local

The following properties are available for the websocket-local output event adapter type.

Property KeyDescriptionData TypeDefault Value
minThreadThe minimum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer8
maxThreadThe maximum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer100
keepAliveTimeInMillisThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer20000
jobQueueSizeThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer10000
Localtab
titleWebsocket

The following properties are available for the websocket output event adapter type.

Property KeyDescriptionData TypeDefault Value
minThreadThe minimum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer8
maxThreadThe maximum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer100
keepAliveTimeInMillisThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer20000
jobQueueSizeThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer10000
Localtab
titleSOAP

The following properties are available for the soap output event adapter type.

Property KeyDescriptionData TypeDefault Value
minThreadThe minimum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer8
maxThreadThe maximum number of threads (including idle threads) that should be available in the thread pool at a given time.Integer100
keepAliveTimeInMillisThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer20000
jobQueueSizeThe maximum number of milliseconds that idle threads should be kept alive when the total number of threads in the pool exceeds the number of cores in the machine.Integer10000
axis2ClientConnectionTimeoutThe number of milliseconds allowed to elapse before the Axis2 client connection times out.Integer10000
reuseHTTPClientIf this property is set to true, it is allowed to reuse the connection to the HTTP client for subsequent requests.Booleantrue
autoReleaseConnectionIf this property is set to true, inactive connections are automatically killed.Booleantrue
maxConnectionsPerHostThe maximum number of connections allowed per host configuration.Integer50

Event publisher configuration
Anchor
Create Event Publisher
Create Event Publisher

...

  The above sections of an event publisher configuration are described below.

SectionDescription
FromThe event stream from which the event publisher will fetch the events for publishing.
ToAn output event adapter(transport) configuration that is used to send the events to.
Adapter properties

Output event adapters contain three types of adapter properties in their configuration as explained below.

  • Static Adapter Properties : You can add these properties via the management console. You cannot change them based on the event.
  • Dynamic Adapter Properties : You can add these properties via the management console. You can change them for each event by adding event attributes as follows: {{ attribute }} E.g.  http://localhost:8000/endpoint/{{endpointId}} 
  • Global Adapter Properties : These properties come from the <PRODUCT_HOME>/repository/conf/output-event-adapters.xml file. They are common for all adapters on its kind which was defined during the event publisher creation.
Mapping configurationThe format of the message that needs to be sent. You can configure custom mappings on the selected format via advanced settings.

Anchor
Creating event publishers
Creating event publishers
Creating event publishers

...

  1. Create an XML file with the following event publisher configurations. An event publisher implementation should start with <eventPublisher> as the root element.

    Note

    In the following configuration, specify the respective adapter properties based on the transport type of the publisher within the <from> element. For the respective adapter properties of the event publisher configuration based on the transport type, see Publishing Events via Various Transports.

    Code Block
    languagexml
    <eventPublisher name="EVENT-PUBLISHER-NAME" statistics="disable"
      trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
      <from streamName="Test Stream" version="1.0.0"/>
      <mapping customMapping="disable" type="text"/>
      <to eventAdapterType="EVENT-ADAPTER-TYPE">
         .....................
      </to>
    </eventPublisher>

    The properties of the above configuration are described below.

    Adapter propertyDescription
    name
    Name of the event publisher
    statistics
    Whether monitoring event statistics is enabled for the publisher
    trace
    Whether tracing events is enabled for the publisher
    xmlns
    XML namespace for event receivers
    streamName
    Name of the event stream from which the publisher publishes events.
    version
    Version of the event stream from which the publisher publishes events.
    customMapping
    Whether a custom mapping is enabled on the receiver.
    type
    Type of the enabled custom mapping.
    eventAdapterType
    Type of the event adapter.
  2.  Add the XML file to the <DAS_HOME>/repository/deployment/server/eventpublishers directory. Since hot deployment is supported in the product, you can simply add/remove event publisher configuration files to deploy/undeploy event publishers to/from the server.

    Note

    First define the stream to which the publisher is publishing data from to activate the publisher. When receiving WSO2Events, the outgoing stream definition that you select in the advanced input mappings must also be defined, to activate the event publisher. When you click Inactive Event Publishers in the Available Event Publishers screen, if an event publisher is in the inactive state due to some issue in the configurations, you view a short message specifying the reason why the event publisher is inactive as shown below. A similar message is also printed on the CLI.

    an inactive publisher

...