public final class OrderStateTransitionMessage extends GenericMessageImpl<Order> implements SimpleOrderMessage
TransitionState
update action.
withStateByBuilder(client(), builder -> builder.type(StateType.ORDER_STATE), state -> { withOrder(client(), order -> { final Order updatedOrder = client().executeBlocking(OrderUpdateCommand.of(order, TransitionState.of(state))); assertThat(updatedOrder.getState()).isEqualTo(state.toReference()); assertEventually(() -> { final PagedQueryResult<OrderStateTransitionMessage> messageQueryResult = client().executeBlocking(MessageQuery.of() .withPredicates(m -> m.resource().is(order)) .forMessageType(OrderStateTransitionMessage.MESSAGE_HINT)); final Optional<OrderStateTransitionMessage> message = messageQueryResult.head(); assertThat(message).isPresent(); assertThat(message.get().getState()).isEqualTo(state.toReference()); //check query model final OrderQuery orderQuery = OrderQuery.of() .withPredicates(m -> m.id().is(order.getId()).and(m.state().is(state))); final Order orderByState = client().executeBlocking(orderQuery) .head().get(); assertThat(orderByState).isEqualTo(updatedOrder); }); return updatedOrder; }); });
See the test code.
Order
,
Order.getState()
,
TransitionState
Modifier and Type | Field and Description |
---|---|
static MessageDerivateHint<OrderStateTransitionMessage> |
MESSAGE_HINT |
static String |
MESSAGE_TYPE |
resource, resourceUserProvidedIdentifiers, resourceVersion, sequenceNumber, type
Modifier and Type | Method and Description |
---|---|
boolean |
getForce() |
Reference<State> |
getOldState() |
Reference<State> |
getState() |
as, equals, getPayload, getResource, getResourceUserProvidedIdentifiers, getResourceVersion, getSequenceNumber, getType, hashCode, toReference
getCreatedAt, getId, getLastModifiedAt, getVersion
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getResource
as, getPayload, getResourceUserProvidedIdentifiers, getResourceVersion, getSequenceNumber, getType, referenceOfId, referenceTypeId, toReference, typeReference
getCreatedAt, getId, getLastModifiedAt, getVersion
hasSameIdAs, toResourceIdentifier
getType
public static final String MESSAGE_TYPE
public static final MessageDerivateHint<OrderStateTransitionMessage> MESSAGE_HINT