File tree 2 files changed +10
-3
lines changed
src/main/java/io/nats/client
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 73
73
*
74
74
* js.publish("foo.joe", "Hello World".getBytes());
75
75
*
76
- * //Wait a moment, then stop the MessageConsumer
76
+ * //Wait a moment, then stop and close the MessageConsumer
77
77
* Thread.sleep(3000);
78
- * mc.stop();
78
+ * mc.stop(); //Stops pull requests
79
+ * mc.close(); //Unsubcribes
79
80
*
80
81
* </pre>
81
82
*
Original file line number Diff line number Diff line change @@ -46,11 +46,17 @@ public interface MessageConsumer extends AutoCloseable {
46
46
ConsumerInfo getCachedConsumerInfo ();
47
47
48
48
/**
49
- * Stop the MessageConsumer from asking for any more messages from the server .
49
+ * Use {@link close()} to unsubscribe. Stop will not unsubcribe or clean up resources .
50
50
* The consumer will finish all pull request already in progress, but will not start any new ones.
51
51
*/
52
52
void stop ();
53
53
54
+ /**
55
+ * Unsubscribe the underlying subject. Close will be lenient. In flight and buffered messages may still be delivered.
56
+ */
57
+ @ Override
58
+ void close () throws Exception ;
59
+
54
60
/**
55
61
* Stopped indicates whether consuming has been stopped. Can be stopped without being finished.
56
62
* @return the stopped flag
You can’t perform that action at this time.
0 commit comments