
When a topic subscriber is not active, messages that were sent during its period of inactivity will not be delivered to it when it becomes active again. If you want to be sure you receive all messages published to a topic, no matter if your subscriber has been continuously active, you can create a durable subscriber.
... Topic topic; String subscription_name = "my_sub"; ... TopicSubscribertopicSubscriber = topicSession.createDurableSubscriber(topic, subscription_name);
topicSubscriber.close();
topicSession.unsubscribe(subscription_name);