
create class if not exists /test() with namespace='test'
-- { onerror(continue) }
;

delete from /test/notify with version
-- { onerror(continue) noerrinfo() }
;

drop class if exists /test/notify
-- { onerror(continue) }
;

create class /test/notify (
    zxid     varchar    "zxid",
    zxname   varchar    "zxname",
    msg      varchar    "msg",
    tally    int        "tally",
    keys(zxid)
) with notify=10s, partition=(zxname)
-- { onerror(continue) subscribe("CLASS_DATA_CHANGE:/") }
;

insert into /test/notify (zxid,zxname,msg,tally) values('{%d,mqli}', '{%d,mqli}', '{%d,mqli}:...32 Bytes...',1)
on conflict
update tally = tally + 1
-- { loop(10) sleep(200ms) }
;

insert into /test/notify (zxid,zxname,msg,tally) values('{%d,mqli}', '{%d,mqli}', '{%d,mqli}:...32 Bytes...',1)
on conflict
update tally = tally + 1
-- { loop(10) sleep(200ms) }
;

insert into /test/notify (zxid,zxname,msg,tally) values('{%d,mqli}', '{%d,mqli}', '{%d,mqli}:...32 Bytes...',1)
on conflict
update tally = tally + 1
-- { loop(10) sleep(200ms) }
;

select zxid,zxname,msg,tally from /test/notify refresh
-- { output() timeout(1000ms) }
;
