I have to do a project for a university course I'm taking and am stuck because I cannot find clarification on a simple question:
How do I properly subscribe and unsubscribe from a topic as a non-durable subscriber? It sounds simple enough, but while for durable there is an unsubscribe method, I just don't know what to use for non-durable.
What I want to do is to be able to sub,unsub and resubscribe to any topic at will. I found a post saying you should use consumer.close(); to unsubscribe, but then I don't know how to resubscribe. consumer.start(); isn't recognized as a command (consumer is an instance of the class MessageConsumer).
so unsubscribe = consumer.close(); //right?
resubscribe after unsubscribing = consumer.??? Or do I need to create a new consumer every time I resubscribe?
programming language: Java
For non-durable subscription, you just need to do a :
That's what is said here :