reject

public Optional<Ack> reject(E envelope)

Rejects the message with the OK status.

This method is a shortcut which can be used in filter when the message does not pass the filter and this is expected.

Return

the Optional.of(Ack) signaling that the message does not pass the filter

Parameters

envelope

the envelope with the message to filter


public Optional<Ack> reject(E envelope, Error cause)

Rejects the message with an Error status.

This method is a shortcut which can be used in filter when the message does not pass the filter due to a technical error or inconsistency in model data.

Return

the Optional.of(Ack) signaling that the message does not pass the filter

Parameters

envelope

the envelope with the message to filter

cause

the cause of the rejection


public Optional<Ack> reject(E envelope, ThrowableMessage cause)

Rejects the message with a rejection status.

This method is a shortcut which can be used in filter when the message does not pass the filter due to a business rejection.

Such rejection method can be used when no technical error occurs but due to the business rules the command should be immediately disqualified from being executed. A typical scenario would be when the permissions of the user who made the request aren't broad enough.

Return

the Optional.of(Ack) signaling that the message does not pass the filter

Parameters

envelope

the envelope with the message to filter

cause

the cause of the rejection

Throws

if the filtered envelope is not a command