Output MySQL event adapter helps to dump the output events to a MySQL database. It is used as an output event adapter.
Follow the steps below to set up the prerequisites before starting the configuration.
<PRODUCT_HOME>/repository/components/lib/
directory.Create a datasource, as the MySQL event adapter uses Carbon datasources.
You can configure the output MySQL event adapter using the management console or using a configuration file.
The steps below explain how to configure output MySQL event adapter using the management console. This deploys the event adapter in the <PRODUCT_HOME>/repository/deployment/server/outputeventadaptors/
directory.
Enter mysql_adapter
for Event Adaptor Name, select mysql
for Event Adaptor Type, and enter the name of the created datasource
as shown in the below example.
Follow the instructions below to configure output MySQL event adapter using a configuration file.
Create an XML file with the following output MySQL event adapter configurations. Output event adapter implementation must start with <outputEventAdaptor>
as the root element.
<outputEventAdaptor name="mysql_adaptor" statistics="disable" trace="disable" type="mysql" xmlns="http://wso2.org/carbon/eventadaptormanager"> <property name="datasource.name">mysqldatasrc1</property> </outputEventAdaptor>
<PRODUCT_HOME>/repository/deployment/server/outputeventadaptors/
directory. Since hot deployment is supported in the product, you can simply add/remove output event adapter configuration files to deploy/undeploy output event adapters to/from the server.After an adapter is successfully added, it gets added to the list of adapters displayed under Event Processor Configs in the Configure menu of the product's management console. Click Edit to change its configuration and redeploy it. This opens an XML-based editor allowing you to edit the event adapter configurations from the UI. Do your modifications and click Update. You can also delete it, enable/disable statistics or enable/disable tracing on it using the provided options in the UI.
The configured output event adapters are used in event formatters. With output event adapter message properties, event formatters are able to extract data from event streams and format the output events. Message properties specific to output event adapters of the mysql
type can be configured as follows.
Click the name of the event formatter to which the relevant output event adapter is connected. This opens the Event Formatter Details page.
The message properties of a mysql
output event adapter are described below. Change the property values as required.
Property | Description |
---|---|
Composite key columns | Column names used in uniqueness check for updates. When an event arrives, the table is searched using the values of these columns and then the matching events are updated. This is not applicable for insert-only mode. |
Execution Mode | Execution mode of the output event. The supported modes are insert-only and insert or update. In insert or update modes, event gets inserted if it doesn't already exist in the table. Otherwise, an existing event in the table is updated. |
Table Name | Name of the database table. |
Output Event Type | The outgoing event type to be mapped. The output MySQL event adapter supports only map type mappings. |