Search in sources :

Example 16 with UTF8StringSerializer

use of io.pravega.client.stream.impl.UTF8StringSerializer in project pravega by pravega.

the class RestoreBackUpDataRecoveryTest method readAllEvents.

// Reads the required number of events from the stream.
private void readAllEvents(String streamName, ClientFactoryImpl clientFactory, ReaderGroupManager readerGroupManager, String readerGroupName, String readerName) {
    readerGroupManager.createReaderGroup(readerGroupName, ReaderGroupConfig.builder().stream(Stream.of(SCOPE, streamName)).build());
    EventStreamReader<String> reader = clientFactory.createReader(readerName, readerGroupName, new UTF8StringSerializer(), ReaderConfig.builder().build());
    for (int q = 0; q < TOTAL_NUM_EVENTS; ) {
        String eventRead = reader.readNextEvent(READ_TIMEOUT.toMillis()).getEvent();
        Assert.assertEquals("Event written and read back don't match", EVENT, eventRead);
        q++;
    }
    reader.close();
}
Also used : UTF8StringSerializer(io.pravega.client.stream.impl.UTF8StringSerializer)

Aggregations

UTF8StringSerializer (io.pravega.client.stream.impl.UTF8StringSerializer)16 Cleanup (lombok.Cleanup)14 Test (org.junit.Test)9 ConnectionFactory (io.pravega.client.connection.impl.ConnectionFactory)8 SocketConnectionFactoryImpl (io.pravega.client.connection.impl.SocketConnectionFactoryImpl)8 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)8 ReaderGroupManager (io.pravega.client.admin.ReaderGroupManager)7 ClientFactoryImpl (io.pravega.client.stream.impl.ClientFactoryImpl)7 ReaderGroupManagerImpl (io.pravega.client.admin.impl.ReaderGroupManagerImpl)6 ClientConfig (io.pravega.client.ClientConfig)5 EventWriterConfig (io.pravega.client.stream.EventWriterConfig)5 StreamImpl (io.pravega.client.stream.impl.StreamImpl)5 StreamManager (io.pravega.client.admin.StreamManager)4 Controller (io.pravega.client.control.impl.Controller)4 ReaderGroup (io.pravega.client.stream.ReaderGroup)4 ScalingPolicy (io.pravega.client.stream.ScalingPolicy)4 Stream (io.pravega.client.stream.Stream)4 EventStreamClientFactory (io.pravega.client.EventStreamClientFactory)3 Checkpoint (io.pravega.client.stream.Checkpoint)3 EventStreamReader (io.pravega.client.stream.EventStreamReader)3