Hey, I’m trying to read using the java api the stream from a ipfs.pubsub.sub(topic). Is there any documentation that might help?
I found this so far but even with this I get an error ForkJoinPool is not a functional interface
public void pubsub() throws Exception {
ipfs.pubsub.sub("demo");
ipfs.pubsub.pub("demo","message1");
ConcurrentLinkedQueue<Object> res = new ConcurrentLinkedQueue<>();
new Thread(() -> {
try {
ipfs.pubsub.sub("demo", res::add); //ForkJoinPool is not a functional interface
} catch (IOException e) {
throw new RuntimeException(e);}
}).start();
while (true) {
if (res.size() > 0) {
Map msg = (Map) res.poll();
if (msg.size() > 0) {
String from = msg.get("from").toString();
String topicId = msg.get("topicIDs").toString();
String seqno = msg.get("seqno").toString();
String data = new String(Base64.getDecoder().decode(msg.get("data").toString()));
System.out.println(from + topicId + seqno + data);
}
}
}
}