iGrafx Case Events Example

Start by using the following command to apply modifications of a STREAM on data inserted before the creation or display of the STREAM :

SET 'auto.offset.reset'='earliest';

First we need to create the initial STREAM storing the caseId for which we want to get information :

CREATE STREAM s1 (
  caseId VARCHAR
  ) WITH (
  kafka_topic = 's1',
  partitions = 1,
  value_format = 'avro'
  );

Then we need to create the STREAM that is going to call to the UDF. Here the UDF parameters are given as an example and can be modified, except for the caseId, as it must match that of the caseId column of the previous STREAM.

CREATE STREAM s2 AS SELECT 
    caseId, 
    igrafx_case_events(caseId, '8968a61c-1fb5-4721-9a8b-d09198eef06b', 'druid_system', <Authentication>', 'https://mining-api.dev2.igrafxcloud.com', '8082') AS informations 
    FROM s1 EMIT CHANGES;

Moreover, we then need to insert a caseID for which we want to get information. In order to retrieve information for a given caseId, the caseId needs to exist in the iGrafx project.

INSERT INTO s1 (caseId) VALUES ('3');

Finally, we can display the final result.

SELECT caseId, informations FROM s2 EMIT CHANGES;