/** * Checks whether the given {@code sagaId} matches with the given {@code segment}. * <p> * For any complete set of segments, exactly one segment matches with any value. * <p> * * @param segment The segment to validate the identifier for * @param sagaId The identifier to test * @return {@code true} if the identifier matches the segment, otherwise {@code false} * * @implSpec This implementation uses the {@link Segment#matches(Object)} to match against the Saga identifier */ protected boolean matchesSegment(Segment segment, String sagaId) { return segment.matches(sagaId); }
/** * Indicates whether the given {@code value} matches this segment. A value matches when the hashCode of a value, * after applying this segments mask, equals to this segment ID. * * @param value The value to verify against. * @return {@code true} if the given value matches this segment, otherwise {@code false} */ public boolean matches(Object value) { return mask == 0 || matches(Objects.hashCode(value)); }
@Override public boolean canHandle(EventMessage<?> eventMessage, Segment segment) { return hasHandler(eventMessage) && segment.matches(Objects.hashCode(getOrDefault( sequencingPolicy.getSequenceIdentifierFor(eventMessage), eventMessage::getIdentifier) )); }
private boolean shouldCreateSaga(Segment segment, boolean sagaInvoked, SagaInitializationPolicy initializationPolicy) { return ((initializationPolicy.getCreationPolicy() == SagaCreationPolicy.ALWAYS || (!sagaInvoked && initializationPolicy.getCreationPolicy() == SagaCreationPolicy.IF_NONE_FOUND))) && segment.matches(initializationPolicy.getInitialAssociationValue()); }
/** * Checks whether the given {@code sagaId} matches with the given {@code segment}. * <p> * For any complete set of segments, exactly one segment matches with any value. * <p> * * @param segment The segment to validate the identifier for * @param sagaId The identifier to test * @return {@code true} if the identifier matches the segment, otherwise {@code false} * * @implSpec This implementation uses the {@link Segment#matches(Object)} to match against the Saga identifier */ protected boolean matchesSegment(Segment segment, String sagaId) { return segment.matches(sagaId); }
/** * Checks whether the given {@code sagaId} matches with the given {@code segment}. * <p> * For any complete set of segments, exactly one segment matches with any value. * <p> * * @param segment The segment to validate the identifier for * @param sagaId The identifier to test * @return {@code true} if the identifier matches the segment, otherwise {@code false} * * @implSpec This implementation uses the {@link Segment#matches(Object)} to match against the Saga identifier */ protected boolean matchesSegment(Segment segment, String sagaId) { return segment.matches(sagaId); }
/** * Indicates whether the given {@code value} matches this segment. A value matches when the hashCode of a value, * after applying this segments mask, equals to this segment ID. * * @param value The value to verify against. * @return {@code true} if the given value matches this segment, otherwise {@code false} */ public boolean matches(Object value) { return mask == 0 || matches(Objects.hashCode(value)); }
/** * Indicates whether the given {@code value} matches this segment. A value matches when the hashCode of a value, * after applying this segments mask, equals to this segment ID. * * @param value The value to verify against. * @return {@code true} if the given value matches this segment, otherwise {@code false} */ public boolean matches(Object value) { return mask == 0 || matches(Objects.hashCode(value)); }
@Override public boolean canHandle(EventMessage<?> eventMessage, Segment segment) { return hasHandler(eventMessage) && segment.matches(Objects.hashCode(getOrDefault(sequencingPolicy.getSequenceIdentifierFor(eventMessage), eventMessage::getIdentifier))); }
@Override public boolean canHandle(EventMessage<?> eventMessage, Segment segment) { return hasHandler(eventMessage) && segment.matches(Objects.hashCode(getOrDefault( sequencingPolicy.getSequenceIdentifierFor(eventMessage), eventMessage::getIdentifier) )); }
private boolean shouldCreateSaga(Segment segment, boolean sagaInvoked, SagaInitializationPolicy initializationPolicy) { return ((initializationPolicy.getCreationPolicy() == SagaCreationPolicy.ALWAYS || (!sagaInvoked && initializationPolicy.getCreationPolicy() == SagaCreationPolicy.IF_NONE_FOUND))) && segment.matches(initializationPolicy.getInitialAssociationValue()); }
private boolean shouldCreateSaga(Segment segment, boolean sagaInvoked, SagaInitializationPolicy initializationPolicy) { return ((initializationPolicy.getCreationPolicy() == SagaCreationPolicy.ALWAYS || (!sagaInvoked && initializationPolicy.getCreationPolicy() == SagaCreationPolicy.IF_NONE_FOUND))) && segment.matches(initializationPolicy.getInitialAssociationValue()); }