Module "broker"

This module provides a Prolog implementation of the actor model. The realization leans to-wards Erlang with the same actor and message semantics. Currently remote access is two way so that a client is notified that a primitive was performed.

Additionally we have bootstrapped a Prolog remote procedure call rpc/2. This predicate can deliver multiple solutions via backtracking. The predicate does react to events in the continuation and will tear down the remote call.

Example:
?- rpc('localhost:3010', father(tom, X)).
X = sally ;
X = erica
?- rpc('localhost:3010', father(tom, X)).
X = sally

Currently we only support unreliable UDP transport sending with up to 4096 bytes. We might add further protocols in the future. Especially a combination with our module "http" and its web sockets is planned which would even allow communication with web browsers.

The following broker predicates are provided:

broker_start(A):
The predicate succeeds in starting a broker identified by the authority A.
broker_stop:
The predicate succeeds in stopping the current broker.
spawn(A, G, P):
The predicate succeeds in P with the actor path of a new actor on the authority A running the goal G. Spawn is blocking until acknowledge is received.
self(P):
The predicate succeeds in P with the actor path of the current actor.
exit(P, M):
The predicate succeeds in interrupting the actor P by an error M. Exit is blocking until acknowledge is received.
send(P, M):
The predicate succeeds in sending the message M to the actor identified by the actor path P. This sending is blocking until acknowledge is received.
receive(L, M):
receive(L, M, T):
The predicate succeeds in M with the message that the current actor received and that matches the pattern and guard disjunction L. Receiving is blocking and succeeds only when a matching message has arrived. The ternary predicate takes an additional timeout parameter.
rpc(A, G):
The predicate succeeds whenever the authority A running the goal G succeeds.

Kommentare