1.createclass.mql 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. create class if not exists /test() with namespace='test'
  2. -- { onerror(continue) }
  3. ;
  4. delete from /test/notify with version
  5. -- { onerror(continue) noerrinfo() }
  6. ;
  7. drop class if exists /test/notify
  8. -- { onerror(continue) }
  9. ;
  10. create class /test/notify (
  11. zxid varchar "zxid",
  12. zxname varchar "zxname",
  13. msg varchar "msg",
  14. tally int "tally",
  15. keys(zxid)
  16. ) with notify=10s, partition=(zxname)
  17. -- { onerror(continue) subscribe("CLASS_DATA_CHANGE:/") }
  18. ;
  19. insert into /test/notify (zxid,zxname,msg,tally) values('{%d,mqli}', '{%d,mqli}', '{%d,mqli}:...32 Bytes...',1)
  20. on conflict
  21. update tally = tally + 1
  22. -- { loop(10) sleep(200ms) }
  23. ;
  24. insert into /test/notify (zxid,zxname,msg,tally) values('{%d,mqli}', '{%d,mqli}', '{%d,mqli}:...32 Bytes...',1)
  25. on conflict
  26. update tally = tally + 1
  27. -- { loop(10) sleep(200ms) }
  28. ;
  29. insert into /test/notify (zxid,zxname,msg,tally) values('{%d,mqli}', '{%d,mqli}', '{%d,mqli}:...32 Bytes...',1)
  30. on conflict
  31. update tally = tally + 1
  32. -- { loop(10) sleep(200ms) }
  33. ;
  34. select zxid,zxname,msg,tally from /test/notify refresh
  35. -- { output() timeout(1000ms) }
  36. ;