A fish consumes events, but emitting events is not coupled to fishes.
Events can be emitted directly using the Actyx Event Service, or using the Actyx Pond. Actyx Pond provides two main APIs
for emitting events:
pond.run (we'll learn how to use state effects later).
Events are tagged with an arbitrary number of tags, each tag being just a non-empty string:
This event will be tagged with four tags:
sender:Alf. We already see that we can add
some structure to the tags by using prefixes.
ActyxOS however does not treat the
: specially. The Actyx Pond contains some convenience functions based on the convention shown above.
Obviously, within the context of Actyx Pond, events usually go together with some business logic implemented in fishes. In this example we consider a fish that models a chat room. The main action that can be performed on such a room is to add a new message. The straight-forward definition given above will emit such an event according to the following event type:
All necessary imports (like
Tags) are available from the
We'll see in the next section about local state, how to construct a fish to make use of the emitted event.