Today we are glad to announce the release of Pond version 2.5.0 on npm!
This release contains a whole new set of functions, which operate on events directly – no Fish required. Read on for a quick overview.
In order to get an instance of the new APIs, either call
events() on your
or initialize directly by calling
EventFns.of(options) where the connection parameters are the same as for the
Event streams on Actyx never end: New events keep being appended to them.
offsets(), the current event numbers (offsets, like in an array) per stream can be retrieved.
queryKnownRange can then be used to get a finite set of events, where
upperBound is at most equal to the current
This is useful for periodically reading all new events, and exporting them to another DB.
As the pattern of taking
offsets() as the
upperBound is so common, we offer
queryAllKnown as a shortcut that automatically fills
upperBound and returns it with the result:
queryAllKnownChunked can be used on devices where memory may be insufficient to hold the full result.
subscribe can be used to install a callback that will be notified whenever new events become known.
This can be used to dynamically update application state, or simply run a continual export of data:
Often you will be interested just in the latest piece of a certain information, for example the latest state of some machine readings.
Fish for that is more complex than needed.
Hence we now offer a dedicated function:
One great thing about
Fish is that events are always fed in a strict order – the same order on every node.
However, in some cases this is not required: E.g. just summing up a series of integers, the order of those integers does not matter. Another example is when you are looking for the highest number among a pile of numbers.
We have added the two new functions
observeUnorderedReduce as simple shortcuts for these cases.
Finally, there is now a second way to emit events.
EventFns can be used to directly pass objects with combined tags and payload:
The recommended usage, though, is to still use the typed
The main advantage of this scheme is that it will properly prevent
Tags<never> from being attached to anything.
We hope this new set of function will help to make apps more expressive and powerful – stay tuned for many more new APIs that we have in the pipeline!