use of io.spine.core.RejectionContext in project core-java by SpineEventEngine.
the class EventsTestEnv method rejectionContext.
public static RejectionContext rejectionContext(TenantId id) {
final Command command = Command.newBuilder().setContext(commandContext(id)).build();
final RejectionContext result = RejectionContext.newBuilder().setCommand(command).build();
return result;
}
use of io.spine.core.RejectionContext in project core-java by SpineEventEngine.
the class RejectionBusAdapter method markExternal.
@Override
ExternalMessageEnvelope markExternal(ExternalMessage externalMsg) {
final Any packedEvent = externalMsg.getOriginalMessage();
final Rejection rejection = AnyPacker.unpack(packedEvent);
final Rejection.Builder rejectionBuilder = rejection.toBuilder();
final RejectionContext modifiedContext = rejectionBuilder.getContext().toBuilder().setExternal(true).build();
final Rejection marked = rejectionBuilder.setContext(modifiedContext).build();
final ExternalMessage result = ExternalMessages.of(marked, externalMsg.getBoundedContextName());
return ExternalMessageEnvelope.of(result, Rejections.getMessage(rejection));
}
Aggregations