EventConsumer buildConsumer()

in simulator/src/main/java/com/google/cloud/App.java [156:172]


  EventConsumer buildConsumer() throws ParameterException, IOException {
    if (orderTopic == null && marketDepthTopic == null && region == null) {
      if (json) {
        return new JSONOutputConsumer();
      } else if (avroPrefix != null) {
        return new AvroOutputConsumer(avroPrefix);
      } else {
        return new StandardOutputConsumer();
      }
    }

    if (orderTopic != null && marketDepthTopic != null) {
      return new PubSubConsumer(orderTopic, marketDepthTopic, region);
    }

    throw new ParameterException("Please specify both --orderTopic and --marketDepthTopic");
  }