SINTEF-9012 / kafka-mqtt-source-connector

A connector plugin to use with Kafka's Connect API. It can be configured to map any topic from an mqtt broker to any topic on the Kafka broker. The connector can be configured to use SSL in communication with the mqtt broker.
MIT License
24 stars 17 forks source link

It does not work! #6

Open ricrug opened 3 years ago

ricrug commented 3 years ago

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!