Example

IBMStreams streamsx.eventstore Toolkit > com.ibm.streamsx.eventstore 2.5.0.beta > com.ibm.streamsx.eventstore > EventStoreSink > Example

SPL example demonstrates the usage of the EventStoreSink operator:

composite Main {
    param
        expression<rstring> $configObject: getSubmissionTimeValue("configObject");
        expression<int32>   $batchSize: (int32)getSubmissionTimeValue("batchSize", "1000");
        expression<rstring> $tableName: getSubmissionTimeValue("tableName");
        expression<rstring> $schemaName: getSubmissionTimeValue("schemaName");

    graph

        stream<rstring KEY, optional<int64> DUMMY> Rows = Beacon() {
            param
                period: 0.01;
            output
                Rows : key = "SAMPLE"+(rstring) IterationCount();
        }

        () as Db2EventStoreSink = com.ibm.streamsx.eventstore::EventStoreSink(Rows) {
            param
                configObject: $configObject;
                keyStore: 'opt/clientkeystore';
                trustStore: 'opt/clientkeystore';
                batchSize: $batchSize;
                primaryKey: 'KEY';
                partitioningKey: 'KEY';
                tableName: $tableName;
                schemaName: $schemaName;
        }
}
In the SPL example above the connection configuration and credentials are stored in an application configuration. You specify the name of the application configuration with the configObject parameter. In the application configuration the following properties shall be set:
  • connectionString
  • databaseName
  • eventStoreUser
  • eventStorePassword
  • keyStorePassword
  • trustStorePassword

The keyStorePassword and trustStorePassword belong to the file referenced with the parameters keyStore and trustStore. In Event Store 2.0 the file stored in opt/clientkeystore contains both truststore and keystore.