Skip to main content

Custom Data Publishing

You're reading Open Banking 3.0.0. The newest release is 4.0.0. Go to the newest release

WSO2 Open Banking Accelerator supports publishing data in the API gateway and authentication components. Additionally, you can publish a new data stream via an executor in the gateway. This page explains how to publish any data stream using a custom executor:

Write an executor for data publishing​

Write a new gateway executor to publish data and configure it according to the Custom Gateway Executor documentation.

Publish data​

Use the publishData method to publish data.

publishData method​

This method validates the data provided in the map against your configurations and publishes them to WSO2 Open Banking Business Intelligence.

The publishData method is available in the following class:

com.wso2.openbanking.accelerator.data.publisher.common.util.OBDataPublisherUtil;

The method signature is as follows:

public static void publishData(String streamName, String streamVersion, Map<String, Object> analyticsData)

Given below is a brief explanation of the input parameters:

  • String streamName: The name of the data stream
  • String streamVersion: The version of the stream.
  • Map<String, Object> analyticsData: A map containing the data attributes (name and value) to be published

For example, you can invoke the method as follows:

OBDataPublisherUtil.publishData(API_LATENCY_INPUT_STREAM, API_LATENCY_STREAM_VERSION, analyticsData);

Configure data streams and attributes​

To define the data stream and the set of attributes you want to publish, configure them as follows:

  1. Open <APIM_HOME>/repository/conf/deployment.toml.

  2. Defining the name of the stream as follows:

    [[open_banking.data_publishing.thrift.stream]]
    name="<Data Stream name>"
  3. For each data attribute configure their name, data type, priority, and whether they are mandatory or optional:

    [[open_banking.data_publishing.thrift.stream.attributes]]
    name=<attribute name>
    priority=<priority>
    required=<boolean>
    type=<attribute type>
    ConfigurationData TypeDescription
    namestringThe name of the data attribute.
    priorityintegerSpecifies the order of the attribute in the data stream.
    requiredbooleanThis is an optional value.
    If this is set to true, a validation will ensure before publishing data that this particular attribute is present in the data map and is not null.
    This is treated as false, if not explicitly mentioned.
    typestringThis is an optional value.
    This validates whether the attribute in the data map is of the type configured.
    Allowed values are string, int, double, long, boolean, and float.
    This is treated as string, if not explicitly mentioned.

Create a custom Siddhi Application​

You can create a customized Siddhi Application to publish your data using the instructions given here

tip

You can refer to the existing Siddhi Applications in WSO2 Open Banking Business Intelligence Accelerator. They publish data for the events of API Invocation, access token, and authentication. The default Siddhi Applications are available in the <OB_BI_ACCELERATOR_HOME>/carbon-home/deployment/siddhi-files directory.

Was this page helpful?