kafka-mqtt-source-connector icon indicating copy to clipboard operation
kafka-mqtt-source-connector copied to clipboard

It does not work!

Open ricrug opened this issue 3 years ago • 0 comments

Maybe nobody has ever tried it but... it doesn't work. The attached examples don't work either... and a quick look at the code shows why:

    private String makeDBDoc(byte[] payload, String topic) {
      String msg = new String(payload);
      Document message = Document.parse(msg);
      Document doc = new Document();
      List<String> topicArr = Arrays.asList(topic.split("/"));
      Long unique_id = Long.parseLong(topicArr.get(21));
      Long quadkey = Long.parseLong(String.join("",topicArr.subList(2,20)));
      String now = ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT);
      Document dt = new Document();
      dt.put("$date",now);
      doc.put("message",message);
      doc.put("unique_id",unique_id);
      doc.put("quadkey",quadkey);
      doc.put("updateDate",dt);
      doc.put("pushed",false);
      return doc.toJson();
    }

with a code written in this way... with numbers thrown in this way... is it possible to have at least a description of the json that it interprets?

Thank you!

ricrug avatar Feb 23 '21 15:02 ricrug