INotifiable

Interface that allows you to create components that can be asynchronously notified.

Description

The INotifiable interface allows you to create components that can be asynchronously notified.

Important points

  • The notification can include an optional argument that describes an occurred event.

Instance methods

notify

Notifies the component about an occured event.

void notify(IContext context, Parameters args) throws ApplicationException

  • context: IContext - (optional) execution context to trace execution through call chain.
  • args: Parameters - notification arguments.

Examples

{
  class MyComponent implements INotifable {
    ...
    public void notify(IContext context, Parameters args) {
      System.out.println("Occurred event " + args.getAsString("event"));
    }
  }
 
  MyComponent myComponent = new MyComponent();
 
  myComponent.notify("123", Parameters.fromTuples("event", "Test Event"));
  }

See also