from

public static RejectionEnvelope from(EventEnvelope event)

Creates a new RejectionEnvelope from the given event.

Throws an IllegalArgumentException if the given event is not a rejection.

Return

new

Parameters

event

the rejection event


public static RejectionEnvelope from(CommandEnvelope origin, Throwable throwable)

Creates an instance of Rejection from the rejected command and a Throwable caused by the ThrowableMessage.

If the producer is not set, uses the DEFAULT_EVENT_PRODUCER as the producer.

Return

new instance of Rejection

Parameters

origin

the rejected command

throwable

the caught error

Throws

if the given Throwable is not caused by a ThrowableMessage