private static void consumeEvents(String ehName, String namespace, String keyName, String token)
      throws EventHubException, IOException, ExecutionException, InterruptedException {
    ConnectionStringBuilder connStr = new ConnectionStringBuilder().setNamespaceName(namespace)
        .setEventHubName(ehName)
        .setSasKeyName(keyName)
        .setSasKey(token);

    EventHubClient client = EventHubClient.createFromConnectionStringSync(connStr.toString(), Executors.newScheduledThreadPool(10));

    EventHubRuntimeInformation runTimeInfo = client.getRuntimeInformation().get();
    int numPartitions = runTimeInfo.getPartitionCount();
    for (int partition = 0; partition < numPartitions; partition++) {
      PartitionReceiver receiver =
          client.createReceiverSync(EventHubClient.DEFAULT_CONSUMER_GROUP_NAME, String.valueOf(partition),
              EventPosition.fromStartOfStream());
      receiver.receive(10).handle((records, throwable) -> handleComplete(receiver, records, throwable));
    }
  }
Tool to read events from Microsoft Azure event hubs.
samza-tools/src/main/java/org/apache/samza/tools/EventHubConsoleConsumer.java