I have been doing some POCs with NATS and NATS streaming servers for past few days. I started with NATS-streaming server by writing a Java client for the same and publishing/subscribing messages to/from NATS-streaming server, clustered along with NATS server. NATS-streaming is pretty neat with providing acknowledgement guids
when the streaming server receives a message from a publisher. I achieved this by registering an AckHandler
and using it like so:
guid[0] = sc.publish("produceQueue", payload, new AckHandler() {
@Override
public void onAck(String nuid, Exception ex) {
LOGGER.debug("Received ACK for guid: {}", nuid);
}
System.out.flush();
latch.countDown();
}
});
However, when I started looking at NATS server (not streaming), I could not find any such AckHandlers (or anything else) which can provide me with an acknowledgement guid
to denote that a message has been successfully published.
NATS-streaming server has a lot of built in functionality that I'm looking for - for instance, message acknowledgements
, max_age
(TTL for a message), durable subscriptions
etc. But it lacks the clustering capability with the current latest version which is out there. On the other hand, NATS server provides the clustering functionality, but I could not find the other features that NATS-streaming provides (unless I've missed it in the documentation).
I know there's an open issue to get NATS vs NATS-streaming capabilities outlined in a single table to be referred to, but its still not done as of yet.
Does NATS server provide with acknowledgements when a message is published to the NATS server? Or an acknowledgement of a message being subscribed by one of the subscribers?