public void processElement()

in src/main/java/com/google/solutions/df/log/aggregations/StreamingBenchmark.java [135:151]


    public void processElement(ProcessContext context)
        throws IOException, JsonDataGeneratorException {

      byte[] payload;
      Map<String, String> attributes = Maps.newHashMap();
      attributes.put(MESSAGE_TYPE_HEADER, this.eventType);

      // Generate the fake JSON according to the schema.
      try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
        dataGenerator.generateTestDataJson(schema, byteArrayOutputStream);

        payload = byteArrayOutputStream.toByteArray();
      }
      PubsubMessage message = new PubsubMessage(payload, attributes);
      LOG.info(message.getPayload().toString());
      context.output(message);
    }