我正在使用下面的执行计划来填充我的hazelcast支持的事件表。 问题是,我如何从另一个执行计划中重用这个现有的hazelcast支持事件表?
这是另一个similar question的后续问题。
@Import('users:1.0.0')
define stream users (meta_name string, correlation_id int);
@from(eventtable = 'hazelcast', cluster.name = 'cluster_a', cluster.password = 'pass@cluster_a')
define table UserTable (name string, id int) ;
from users
select meta_name as name, correlation_id as id
insert OVERWRITE UserTable
on UserTable.id == id;
答案 0 :(得分:2)
您可以在两个执行计划中使用相同的collection.name
。您无需使用cluster.name
和cluster.password
。请参阅以下示例;
执行计划1
@Plan:name('TestIn')
@Import('dataIn:1.0.0')
define stream dataIn (id int, name string);
@from(eventtable = 'hazelcast', collection.name='hzTable')
define table hzTable (id int, name string);
from dataIn
insert into hzTable;
执行计划2
@Plan:name('TestOut')
@Export('dataOut:1.0.0')
define stream dataOut (id int, name string);
@from(eventtable = 'hazelcast', collection.name='hzTable')
define table hzTable (id int, name string);
define trigger periodicTrigger at every 2 sec;
from periodicTrigger join hzTable
select hzTable.id as id, hzTable.name as name
insert into dataOut;