Search in sources :

Example 11 with StreamBufferEvent

use of uk.gov.justice.services.event.buffer.core.repository.streambuffer.StreamBufferEvent in project microservice_framework by CJSCommonPlatform.

the class ConsecutiveEventsSpliterator method tryAdvance.

@Override
public boolean tryAdvance(final Consumer<? super StreamBufferEvent> consumer) {
    if (!eventStreamIterator.hasNext()) {
        return false;
    } else {
        final StreamBufferEvent next = eventStreamIterator.next();
        final long version = next.getVersion();
        if (versionGapFound(version)) {
            return false;
        } else {
            currentVersion = version;
            consumer.accept(next);
            return true;
        }
    }
}
Also used : StreamBufferEvent(uk.gov.justice.services.event.buffer.core.repository.streambuffer.StreamBufferEvent)

Aggregations

StreamBufferEvent (uk.gov.justice.services.event.buffer.core.repository.streambuffer.StreamBufferEvent)11 UUID (java.util.UUID)10 UUID.randomUUID (java.util.UUID.randomUUID)10 Test (org.junit.Test)10 JsonEnvelope (uk.gov.justice.services.messaging.JsonEnvelope)10 StreamStatus (uk.gov.justice.services.event.buffer.core.repository.streamstatus.StreamStatus)6 StreamCloseSpy (uk.gov.justice.services.test.utils.common.stream.StreamCloseSpy)1