@Override public Boolean resolveParameterValue(Message<?> message) { return CurrentUnitOfWork.map(unitOfWork -> !(unitOfWork instanceof BatchingUnitOfWork<?>) || ((BatchingUnitOfWork<?>) unitOfWork).isLastMessage(message)).orElse(true); }
@Override public InterceptorChain resolveParameterValue(Message<?> message) { return CurrentUnitOfWork.map(uow -> (InterceptorChain) uow.getResource(INTERCEPTOR_CHAIN_EMITTER_KEY)) .orElseThrow(() -> new IllegalStateException( "InterceptorChain should have been injected")); }
/** * Returns the Correlation Data attached to the current Unit of Work, or an empty {@link MetaData} instance * if no Unit of Work is started. * * @return a MetaData instance representing the current Unit of Work's correlation data, or an empty MetaData * instance if no Unit of Work is started. * @see UnitOfWork#getCorrelationData() */ public static MetaData correlationData() { return CurrentUnitOfWork.map(UnitOfWork::getCorrelationData).orElse(MetaData.emptyInstance()); }
/** * Returns the ConflictResolver instance that can be used to resolve conflicts of an Aggregate that has been * <em>previously loaded in this Unit of Work</em>. Note that, when multiple aggregates are loaded, the * {@link ConflictResolver} that was registered last, is returned. * <p> * Any conflicts must be resolved (by invoking one of the methods on {@link ConflictResolver}) before the Unit of * Work is committed. * <p> * If no Aggregate was loaded, or no conflicts are present, this method will return a {@link NoConflictResolver}, * instance. * * @return The ConflictResolver for the last loaded Aggregate. */ public static ConflictResolver getConflictResolver() { return CurrentUnitOfWork.map(uow -> { ConflictResolver conflictResolver = uow.getResource(CONFLICT_RESOLUTION_KEY); return conflictResolver == null ? NoConflictResolver.INSTANCE : conflictResolver; }).orElse(NoConflictResolver.INSTANCE); }
@Override public InterceptorChain resolveParameterValue(Message<?> message) { return CurrentUnitOfWork.map(uow -> (InterceptorChain) uow.getResource(INTERCEPTOR_CHAIN_EMITTER_KEY)) .orElseThrow(() -> new IllegalStateException( "InterceptorChain should have been injected")); }
@Override public Boolean resolveParameterValue(Message<?> message) { return CurrentUnitOfWork.map(unitOfWork -> !(unitOfWork instanceof BatchingUnitOfWork<?>) || ((BatchingUnitOfWork<?>) unitOfWork).isLastMessage(message)).orElse(true); }
/** * Returns the Correlation Data attached to the current Unit of Work, or an empty {@link MetaData} instance * if no Unit of Work is started. * * @return a MetaData instance representing the current Unit of Work's correlation data, or an empty MetaData * instance if no Unit of Work is started. * @see UnitOfWork#getCorrelationData() */ public static MetaData correlationData() { return CurrentUnitOfWork.map(UnitOfWork::getCorrelationData).orElse(MetaData.emptyInstance()); }
/** * Returns the Correlation Data attached to the current Unit of Work, or an empty {@link MetaData} instance * if no Unit of Work is started. * * @return a MetaData instance representing the current Unit of Work's correlation data, or an empty MetaData * instance if no Unit of Work is started. * @see UnitOfWork#getCorrelationData() */ public static MetaData correlationData() { return CurrentUnitOfWork.map(UnitOfWork::getCorrelationData).orElse(MetaData.emptyInstance()); }
@Override public InterceptorChain resolveParameterValue(Message<?> message) { return CurrentUnitOfWork.map(uow -> (InterceptorChain) uow.getResource(INTERCEPTOR_CHAIN_EMITTER_KEY)) .orElseThrow(() -> new IllegalStateException( "InterceptorChain should have been injected")); }
@Override public Boolean resolveParameterValue(Message<?> message) { return CurrentUnitOfWork.map(unitOfWork -> !(unitOfWork instanceof BatchingUnitOfWork<?>) || ((BatchingUnitOfWork<?>) unitOfWork).isLastMessage(message)).orElse(true); }
/** * Returns the ConflictResolver instance that can be used to resolve conflicts of an Aggregate that has been * <em>previously loaded in this Unit of Work</em>. Note that, when multiple aggregates are loaded, the * {@link ConflictResolver} that was registered last, is returned. * <p> * Any conflicts must be resolved (by invoking one of the methods on {@link ConflictResolver}) before the Unit of * Work is committed. * <p> * If no Aggregate was loaded, or no conflicts are present, this method will return a {@link NoConflictResolver}, * instance. * * @return The ConflictResolver for the last loaded Aggregate. */ public static ConflictResolver getConflictResolver() { return CurrentUnitOfWork.map(uow -> { ConflictResolver conflictResolver = uow.getResource(CONFLICT_RESOLUTION_KEY); return conflictResolver == null ? NoConflictResolver.INSTANCE : conflictResolver; }).orElse(NoConflictResolver.INSTANCE); }
/** * Returns the ConflictResolver instance that can be used to resolve conflicts of an Aggregate that has been * <em>previously loaded in this Unit of Work</em>. Note that, when multiple aggregates are loaded, the * {@link ConflictResolver} that was registered last, is returned. * <p> * Any conflicts must be resolved (by invoking one of the methods on {@link ConflictResolver}) before the Unit of * Work is committed. * <p> * If no Aggregate was loaded, or no conflicts are present, this method will return a {@link NoConflictResolver}, * instance. * * @return The ConflictResolver for the last loaded Aggregate. */ public static ConflictResolver getConflictResolver() { return CurrentUnitOfWork.map(uow -> { ConflictResolver conflictResolver = uow.getResource(CONFLICT_RESOLUTION_KEY); return conflictResolver == null ? NoConflictResolver.INSTANCE : conflictResolver; }).orElse(NoConflictResolver.INSTANCE); }