filter

public Optional<Ack> filter(CommandEnvelope envelope)

Accepts or rejects a passed message.

A filter can:

  • accept the message (by returning Optional.empty());
  • reject the message with Error status, for example, if it fails to pass the validation;
  • reject the message with OK status. For example, a scheduled command may not pass a filter;
  • reject the message with a business rejection. For example, a command can be rejected if the user who made the request does not have enough permissions in the system. Such rejection is only applicable to commands.

Return

Optional.empty() if the message passes the filter, posting result with either status otherwise

Parameters

envelope

the envelope with the message to filter