com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

Sample 0120 - Using the Map Extension

Introduction

This sample demonstrates the usage of the map extension with a basic pass through query. It selects some attributes that are specific for the each incoming event and gives an output event with the selected attributes. This receives data via an http request. The received events are logged by the log event publisher.

The following three queries are performed in the given order.

  1. The following query is performed on the received data from the DataIn event stream. Then specific objects are filtered from the received stream and published to the innerStream.

    from dataIn
    select name,map:createFromJSON(specificAttributesObj) as specAttrObjMap
    insert into innerStream;
  2. The following query retrieves data from the innerStream. Then the temperature value that belongs to the specific attributes are sent to innerStreamTwo with the name of the event.

    from innerStream
    select name,map:get(specAttrObjMap,'temperature') as temp
    insert into innerStreamTwo;
  3. If the temperature value is not null in the stream received from innerStreamTwo, the following query casts the temperature value into a string and publishes it to the dataOut stream with the event name.

    from innerStreamTwo[not(temp is null)]
    select name, cast(temp, 'string') as temperature
    insert into dataOut;

Prerequisites

Set up the prerequisites required for all samples.

Building the sample

Start the WSO2 DAS server with the sample configuration numbered 0120. For instructions, see Starting sample CEP configurations.

This sample configuration points the default Axis2 repo to <DAS_HOME>/samples/cep/artifacts/0120 (by default, the Axis2 repo is <DAS_HOME>/repository/deployment/server).

Executing the sample

Open a new tab in your CLI and execute the following ant command from the <DAS_HOME>/samples/cep/producers/http directory.

ant -Durl=http://localhost:9763/endpoints/httpReceiver -Dsn=0120

The other optional parameters that can be used in the above command are defined in the <DAS_HOME>/samples/cep/producers/http/build.xml file.

This builds the HTTP client and publishes the events in the <DAS_HOME>/samples/cep/artifacts/0120/httpReceiver.txt file to the httpReceiver endpoint. You can view the details of the events that are sent as shown in the log below.

JSON events are logged as shown below.

 

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.