Skip to content

Writing a new stage

jwestberg edited this page Nov 19, 2012 · 2 revisions

Writing your own stage

Extend any of the Abstract classes found in hydra-api project under the package name com.findwise.hydra.stage. Your class needs to annotated with the @Stage annotation. If you annotate any parameters with @Parameter, AbstractStage will ensure that any parameters stored in the database backend is injected into the stage object before any method other than the constructor is called.

In order to write a stage used for processing (modifying a document somehow), simply extend AbstractProcessStage and implement process(). It is possible to extend the other classes as well, depending on your need, but AbstractProcessStage is what you probably want if your goal is to modify the document.

Most stages will use a field to read data to act upon from, process this data somehow, and write to a new field. If your stage is like this, you could extend AbstractMappingProcessStage instead and gain some of that functionality for free in a standardized manner. See AbstractMappingProcessStage or CopyStage.