// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/EventResponse.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class EventResponse {
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    private String summary;
// 
//    private Event content;
// }


import java.net.MalformedURLException;
import java.net.URL;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.impl.client.BasicCredentialsProvider;
import de.qyotta.eventstore.model.EventResponse;
         try {
            final StreamEventsSlice slice = esHttpEventStore.readEventsForward(streamName, nextEventNumber, 4096, "");

            final long end = System.currentTimeMillis();

            final double throughput = slice.getNextEventNumber() / (double) ((end - start) / 1000);

            String x = "";

            if (slice.isEndOfStream()) {
               x += "[head of stream reached] ";
            }

            x += "Read " + slice.getNextEventNumber() + ". throughput:" + throughput + " events/s";

            System.out.println(x);
            nextEventNumber = slice.getNextEventNumber();
            retryWaitTime = 1;
         } catch (final Exception e) {
            System.err.println("Failed to process. Job ends now, but will be re-scheduled in " + retryWaitTime + " ms. Don't worry: " + e + " caused by: " + e.getCause()
                  .getMessage());
            Thread.sleep(retryWaitTime);
            retryWaitTime = retryWaitTime * 2;
         }

      }

   }

   private static void readBackwards() throws ReadFailedException {
// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/EventResponse.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class EventResponse {
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    private String summary;
// 
//    private Event content;
// }


// Path: eventstore-client/src/main/java/de/qyotta/neweventstore/MainExample.java
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.impl.client.BasicCredentialsProvider;
import de.qyotta.eventstore.model.EventResponse;

         try {
            final StreamEventsSlice slice = esHttpEventStore.readEventsForward(streamName, nextEventNumber, 4096, "");

            final long end = System.currentTimeMillis();

            final double throughput = slice.getNextEventNumber() / (double) ((end - start) / 1000);

            String x = "";

            if (slice.isEndOfStream()) {
               x += "[head of stream reached] ";
            }

            x += "Read " + slice.getNextEventNumber() + ". throughput:" + throughput + " events/s";

            System.out.println(x);
            nextEventNumber = slice.getNextEventNumber();
            retryWaitTime = 1;
         } catch (final Exception e) {
            System.err.println("Failed to process. Job ends now, but will be re-scheduled in " + retryWaitTime + " ms. Don't worry: " + e + " caused by: " + e.getCause()
                  .getMessage());
            Thread.sleep(retryWaitTime);
            retryWaitTime = retryWaitTime * 2;
         }

      }

   }

   private static void readBackwards() throws ReadFailedException {
      final EventResponse lastEvent = esHttpEventStore.readLastEvent(streamName);