@Test void writeRecord() throws UnsupportedEncodingException { write(s -> s.writeRecord("test_stream", Json.createObjectBuilder().add("id", 1).add("name", "Test").build()), "{\"type\":\"RECORD\",\"stream\":\"test_stream\",\"time_extracted\":\"2019-08-23T11:26:00.000Z\",\"record\":{\"id\":1,\"name\":\"Test\"}}"); }
public synchronized void writeRecord(final String stream, final JsonObject record) { final JsonObject json = builderFactory .createObjectBuilder() .add("type", "RECORD") .add("stream", requireNonNull(stream, "stream can't be null")) .add("time_extracted", formatDate(dateTimeSupplier.get())) .add("record", record) .build(); runIo.getStdout().println(json); }
Singer { public synchronized void writeRecord(final String stream, final JsonObject record) { final JsonObject json = builderFactory .createObjectBuilder() .add("type", "RECORD") .add("stream", requireNonNull(stream, "stream can't be null")) .add("time_extracted", formatDate(dateTimeSupplier.get())) .add("record", record) .build(); runIo.getStdout().println(json); } }
Singer { public synchronized void writeRecord(final String stream, final JsonObject record) { final JsonObject json = builderFactory .createObjectBuilder() .add("type", "RECORD") .add("stream", requireNonNull(stream, "stream can't be null")) .add("time_extracted", formatDate(dateTimeSupplier.get())) .add("record", record) .build(); runIo.getStdout().println(json); } Singer(); }
Singer { public synchronized void writeRecord(final String stream, final JsonObject record) { final JsonObject json = builderFactory .createObjectBuilder() .add("type", "RECORD") .add("stream", requireNonNull(stream, "stream can't be null")) .add("time_extracted", formatDate(dateTimeSupplier.get())) .add("record", record) .build(); runIo.getStdout().println(json); } Singer(); String formatDate(final ZonedDateTime dateTime); synchronized void writeState(final JsonObject state); synchronized void writeSchema(final String stream, final JsonObject schema, final JsonArray keys,
            final JsonArray bookmarks); synchronized void writeRecord(final String stream, final JsonObject record); synchronized void stdout(final String message); synchronized void stderr(final String message); }
Singer { public synchronized void writeRecord(final String stream, final JsonObject record) { final JsonObject json = builderFactory .createObjectBuilder() .add("type", "RECORD") .add("stream", requireNonNull(stream, "stream can't be null")) .add("time_extracted", formatDate(dateTimeSupplier.get())) .add("record", record) .build(); runIo.getStdout().println(json); } Singer(); String formatDate(final ZonedDateTime dateTime); synchronized void writeState(final JsonObject state); synchronized void writeSchema(final String stream, final JsonObject schema, final JsonArray keys,
            final JsonArray bookmarks); synchronized void writeRecord(final String stream, final JsonObject record); synchronized void stdout(final String message); synchronized void stderr(final String message);  }