Question

Can 2 WHEN case statements distribute events to same stream via Router ?


  1. I am trying to modify an existing Striim App which routes events based on the table name to different Target Writers. 
    I would like to know if two different WHEN statements can be routed to the same stream.
    Based on the Striim Router documentation here .
    Can the sample code be modified to route the events of two case statements to `stream_one` as shown below. 
CREATE ROUTER myRouter INPUT FROM mySourceStream AS src 
CASE
WHEN TO_INT(src.data[1]) < 150 THEN ROUTE TO stream_one,
WHEN TO_INT(src.data[1]) >= 150 THEN ROUTE TO stream_two,
WHEN meta(src,"TableName").toString() like 'QATEST.TABLE_%' THEN ROUTE TO stream_one,
ELSE ROUTE TO stream_else;
  1. Exploring other possible ways to resolve the above issue - Is it possible to write the above as a Boolean logic? 
    CREATE OR REPLACE ROUTER myRouter INPUT FROM mySourceStream AS src
    CASE
    WHEN meta(src,"TableName").toString() like 'QATEST.USERS' THEN ROUTE TO stream_one
    OR WHEN meta(src,"TableName").toString() like 'QATEST.ACCOUNTS' THEN ROUTE TO stream_one
    ELSE ROUTE TO stream_else;

    Any feedback on acceptable syntax is appreaciated, Thanks

0 replies

Be the first to reply!

Reply