Initial Release
The purpose of this repository is to provide a simple example of Publisher-Subscriber model implemented using InterSystems Caché.
This example came out of a session which discussed ways of processing work asynchronously using persistent queues.
set path="C:\Temp\cache-iat-pubsub-master\cache"
do $system.OBJ.ImportDir(path,"*.inc","ck",.error,1)
do $system.OBJ.ImportDir(path,"*.xml","ck",.error,1)
; create events and subscriber jobs
do ##class(IAT.S05.PubSub.Example.Main).Setup()
; send some messages to channels
do ##class(IAT.S05.PubSub.Example.Main).Run()
; show log
zwrite ^PubSub.Log
Caché Event API is used to let the subscriber processes sleep until they are notified.
The following classes provides an example of how the main classes could be used, in this case there are two subscribers:
After running the example, the log stored in ^PubSub.Log global will look similar to this:
There are several points of this example that can be discussed as an exercise:
Have a look at InterSystems Developer Community to learn about InterSystems technology, sharing solutions and staying up-to-date on the latest developments.
This example was published in https://community.intersystems.com/post/simple-systemevent-examples