Apama 10.15.0 | Connecting Apama Applications to External Components | Standard IAF Plug-ins | The Database Connector IAF Adapter (ADBC) | The Visual Event Mapper | Using the Visual Event Mapper
 
Using the Visual Event Mapper
ADBC uses the SQL driver to perform the conversion between Apama types and SQL (JDBC) types. Any restrictions are due to the SQL database vendor and the SQL driver being used.
*To map an Apama event to a table in a database
1. Add a new instance of the ADBC Adapter or open an existing instance and select the adapter editor's Event Mapping tab.
2. If you want Software AG Designer to automatically generate an EPL monitor to listen for events of the specified type, make sure the Generate Store Monitors option is enabled; this is the default setting. In addition to generating all the necessary EPL code for monitors that listen for events of the specified types, all the EPL code that interacts with the database is generated: opening the database, checking the adapter status, storing event data, etc. This setting is useful if your application does not need to guarantee that each event is persisted. The generated monitor provides a best effort storage implementation suitable for storing data to be analyzed in tools like Analyst Studio. The generated monitor does not perform any filtering so all events of the type specified will be stored.
If your application needs to perform filtering of the events or needs to guarantee that each event will be persisted, you should disable Generate Store Monitors option and manually write the required code for the EPL monitors and for interacting with the database.
3. Make sure there is a check mark in the Auto Start check box (this is the default) if you want to start saving event data immediately when you launch the project. If you clear the check mark in the Auto Start check box, your application will need to manually send a StartStoreConfiguration event in order to start storing events.
4. In the adapter editor, click the Add button. The Event Persistence Configuration dialog opens.
5. In the Event Persistence Configuration dialog, click the Browse button next to the Event field. The Event Type Selection dialog opens, displaying the available event types you can select from. Only events that can be emitted are shown; events that contain fields with contexts or actions are not displayed.
6. In the Event Type Selection dialog, select the event type you want to map as follows:
a. In the Event Type Selection field, enter the name of the event. As you type, event types that match what you enter are shown in the Matching Items list. When you select an event, the full name is shown on the dialog's status line. You can turn off this display with the dialog's Down Arrow menu icon (Down-arrow icon).
b. In the Matching Items list, select the name of the event type you want to map. The name of the EPL file that defines the selected event is displayed in the status area at the bottom of the dialog.
c. Click OK.
7. In the Event Persistence Configuration dialog, click the Browse button next to the Database table field. The Database Table Selection dialog opens.
8. In the Database Table Selection dialog, select the database table to which you want to map the event's fields as follows:
a. In the Database Server Details section, specify the DB URL, User Name, and Password. By default, the DB URL uses the value used in the adapter configuration settings. You can change the name of the database by un-checking the check box and entering a new name. (Note, you cannot change the type of database.)
b. Click Connect to access the database.
c. Select the name of the table from the Matching Items list or enter text in the Database Table Selection field. As you type, table names that match what you enter are shown in the Matching Items list. When you select a table, its name is also shown on the dialog's status line. You can turn off this display with the dialog's Down Arrow menu icon (Down-arrow icon).
d. In the Matching Items list, select the name of the database table where you want to store the event data.
e. Click OK.
9. In the Event Persistence Configuration dialog, click OK. The adapter editor display is updated to show the name of the event type and the database table in the Event section. The Mapping Rules section displays lists for Event and Database Table.
10. For each event field you want to store in the Event list click on the field and draw a line to the desired column in the Database Table list.
When you save the adapter instance configuration, mapping rules are generated that specify the associations between event fields and database columns. A monitor that listens for events of the specified type is also generated. The monitor allows the Apama application to manage when the events are written to the database.