I can see no other option other than loading within in individual execution plans.
There are two options:
- Use trigger to load reference data periodically from RDBMS to Hazelcast. The actual process will use from Hazelcast table (This execution plan has been provided below)
- Load from RDBMS and cache it.
So, at this moment, my questions are:
- Which one is better in terms of memory utilization ?
- Which one is better in terms of event processing speed ?
- Please suggest if there are any other better way.
Execution Plan
@Plan:name('ExecutionPlan')
/* define streams/tables and write queries here ... */
/* Facts/Events streams definition */
@Import('actions:1.0.0')
define stream actions (meta_name string, correlation_id int);
@Export('userActions:1.0.0')
define stream userACtions (meta_username string, meta_actionname string);
/* Dimension tables(Event Tables) definition */
-- table from RDBMS
@from(eventtable = 'rdbms' , datasource.name = 'PG' , table.name = 'users')
@IndexBy('id')
define table DBUsers (id int, name string);
-- table from Hazelcast
@from(eventtable = 'hazelcast', collection.name='hzUsers')
@IndexBy('id')
define table hzUsers (id int, name string);
/* Load dimension tables, from RDBMS to Hazelcast, periodically using trigger */
define trigger periodicTrigger at every 30 sec;
from periodicTrigger join DBUsers
select DBUsers.id as id, DBUsers.name as name
insert into hzUsers;
/* Actual execution plan */
from actions as A
join hzUsers as H
on A.correlation_id == H.id
select H.name as meta_username, A.meta_name as meta_actionname
insert into userACtions;