Getting started with Apama Queries and DES

Getting started with Apama Queries and DES

In this blog I’ll describe a simple example to get you started with Apama queries and the Digital Event Service (DES). Two technologies within the SoftwareAG webMethods analytics Suite.

Following components were used in the setup (on version 10.0):

  • Apama
  • Universal Messaging (UM)
  • webMethods Integration Server (IS)

For those new to the Digital Event Service (DES) and/or Apama, it may be helpful to read the introductions on documentation.softwareag.com.

The example setup: Our webMethods IS receives Car parking events for the City of Ghent and publishes the events to UM. An Apama query subscribes to the events, when Apama detects the predefined pattern it publishes an alert back to UM.

Configuring the project

Open the ‘Apama workbench’ workspace in Designer and create a new Apama project. Under ‘Connectivity and Adapters’, we’ll only need the ‘Digital event services’ and ‘Universal messaging’ packages. Find the ‘UMConnectivity.properties’ file and provide to url to the UM realm. To enable the query functionality add the Query Support Bundle to the project.

Now comes the DES magic, open the ‘EventTypeList.apamades’ file and click the ’Sync from Digital Event Services’. Eclipse will look for DES events on UM and generate the required Apama assets for you. Note that the 2 selected events (screenshot below) were created via the IS by defining publishable IS documents. These were synchronised to UM on the DES channel.

Under the ‘autogenerated’ directory you’ll find the generated monitor files which defines the ParkingEvent and the GeneralAlert in the context of Apama.

Creating the CEP logic

There are 2 ways to define CEP logic in Apama, the conventional way using monitor scripts and via the query language. In this guide we’ll use a query to define the event pattern. Apama has a specific channel on which queries listen for incoming events. First create a Monitor script which sends every received event to this “com.apama.queries”-channel.

Create a monitor file under the ‘monitors’ directory:

Let’s create the query itself. The query can be configured by a GUI or via the apama query language. Define the events on which to listen (ParkingEvent), a pattern, the condition and the action to be performed when the pattern is detected. In this case we’ll create a new event and print a log to the console (see screenshot and source code below).

Note that the source code is generated when you’ll configure it via the GUI. To test the setup, you can define some test events in a ‘.evt’ file under the events directory. Verify the setup by pressing the play button and looking at console output.

That’s all. Now you’re ready to dive deeper into the query language and start building more advanced CEP patterns!

Don’t hesitate to reach out on Twitter or LinkedIn.
Greetings, Samuel



Apply for these jobs
Working at i8c
i8c is a system integrator that strives for an informal atmosphere between its employees, who have an average age of approx 30 years old. We invest a lot of effort in the professional development of each individual, through a direct connection between the consultants and the management (no multiple layers of middle management). We are based in Kontich, near Antwerp, but our customers are mainly located in the triangle Ghent-Antwerp-Brussels and belong to the top 500 companies in Belgium (Securex, Electrabel, UCB, etc…).
Quality Assurance
i8c is committed to delivering quality services and providing customer satisfaction. That’s why we invested in the introduction of a Quality Management System, which resulted in our ISO9001:2000 certification. This guarantees that we will meet your expectations, as a reliable, efficient and mature partner for your SOA & integration projects. i8c also signed the eTIC Benelux charter, which proves our commitment to ethical service delivery.