Skip navigation links

Package org.apache.gobblin.util.callbacks

This package provides some simple instrumentation to handling callback execution.

See: Description

Package org.apache.gobblin.util.callbacks Description

This package provides some simple instrumentation to handling callback execution.
Listeners
Listeners are the object to which the callbacks are sent. This package does not impose too many restrictions on what listeners should look like. For a given CallbacksDispatcher, they should all implement the same interface.
Callbacks
Callbacks are represented as Function instances which take one L parameter, the listener to be applied on, and can return a result of type R. If no meaningful result is returned, R should be Void. There is a helper class Callback which allows to assign a meaningful string to the callback. Typically, this is the name of the callback and short description of any bound arguments.

Note that callback instances as defined above can't take any arguments to be passed to the listeners. They should be viewed as a binding of the actual callback method call to a specific set of arguments.

For example, if we want to define a callback void onNewJob(JobSpec newJob) to be sent to JobCatalogListener interface, we need:

  • Define the NewJobCallback implements Callback
  • In the constructor, the above class should take and save a parameter for the JobSpec.
  • The apply method, should look something like input.onNewJob(this.newJob)
Callbacks Dispatcher
The CallbacksDispatcher is responsible for:
Skip navigation links