PublicShow sourcebroadcast.pl -- Event service

Generic broadcasting service. Broadcasts are made using the predicate broadcast(+Templ). All registered `listeners' will have their goal called. Success or failure of this is ignored. The listener can not bind arguments.

This library is particulary useful for disconnecting modules in an application. Modules can broadcast events such as changes, anticipating other modules need to react on such changes. For example, settings.pl broadcasts changes to settings, allowing dependent modules to react on changes:

:- listing(setting(changed(http:workers, New)),
           change_workers(New)).

change_workers(New) :-
        setting(http:port, Port),
        http_workers(Port, New).
Sourcelisten(+Listener, +Templ, :Goal) is det
Sourcelisten(+Templ, :Goal) is det
Open a channel for listening for events of the given `Templ'.
Sourceunlisten(+Listener) is det
Sourceunlisten(+Listener, +Templ) is det
Sourceunlisten(+Listener, +Templ, :Goal) is det
Destroy a channel. All arguments may be variables, removing the all matching listening channals.
Sourcelistening(?Listener, ?Templ, ?Goal) is nondet
returns currently open channels
Sourcebroadcast(+Templ) is det
Broadcast given event.
Sourcebroadcast_request(+Templ) is nondet
Broadcast given event till accepted. Succeeds then, fail if no listener accepts the call. Bindings made by the listener goal are maintained. May be used to make broadcast requests.
Sourcelisten(+Listener, +Templ, :Goal) is det
Sourcelisten(+Templ, :Goal) is det
Open a channel for listening for events of the given `Templ'.
Sourceunlisten(+Listener) is det
Sourceunlisten(+Listener, +Templ) is det
Sourceunlisten(+Listener, +Templ, :Goal) is det
Destroy a channel. All arguments may be variables, removing the all matching listening channals.
Sourceunlisten(+Listener) is det
Sourceunlisten(+Listener, +Templ) is det
Sourceunlisten(+Listener, +Templ, :Goal) is det
Destroy a channel. All arguments may be variables, removing the all matching listening channals.