Plugins serve as an abstract to compose mechanisms for getting data into and out of HornetQ. See the README.md of the project for a list of offical Onyx plugins, or keep reading to roll your own.
In order to implement a plugin, a number of multimethods need to be extended from the Pipeline Extensions API. Reader plugins will want to implement one or more of read-batch
, decompress-batch
, strip-sentinel
, requeue-sentinel
, ack-batch
, and apply-fn
. Writer plugins will want to implement one or more of apply-fn
, compress-batch
, write-batch
, and seal-resource
. See the docstrings for instructions on implementation.
Sometimes, it's adventageous for a plugin to figure out what segments to push into Onyx without the user explicitly helping. For example, the SQL plugin uses a partition-keys
function to scan the range of keys in a table, then slice it up into evenly sized key spaces. The key spaces are sent down to the next task, where peers read records out of the SQL table for their particular key space.
This sort of dynamic behavior is accomplished via bootstrapping. By setting :onyx/bootstrap?
to true
, Onyx will enqueue a single segment (which should be ignored), followed by the sentinel. In the apply-fn
function of the Pipeline extentions, you can perform a computation to dynamically generate segments to be passed downstream.
To help move past the boilerplate of creating new plugins, use Leiningen with onyx-plugin
to generate a template.