use of uk.gov.justice.services.eventsourcing.repository.jdbc.exception.InvalidPositionException in project microservice_framework by CJSCommonPlatform.
the class DefaultEventRepository method storeEvent.
@Override
@Transactional(dontRollbackOn = OptimisticLockingRetryException.class)
public void storeEvent(final JsonEnvelope envelope) throws StoreEventRequestFailedException {
try {
final Event event = eventConverter.eventOf(envelope);
logger.trace("Storing event {} into stream {} at position {}", event.getName(), event.getStreamId(), event.getSequenceId());
eventJdbcRepository.insert(event);
} catch (InvalidPositionException ex) {
throw new StoreEventRequestFailedException(String.format("Could not store event for position %d of stream %s", envelope.metadata().position().orElse(null), envelope.metadata().streamId().orElse(null)), ex);
}
}
Aggregations