Brocker C++ , Client java jms
It is correct to send a message to a topic and just after create a consumer on this Topic ?
connection = connectionFactory.createConnection();
connection.start();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
topic = (Destination) context.lookup("topicSend");
Destination tempTopic = (Destination) context.lookup("topicSend");
MessageProducer messageProducer = session.createProducer(topic);
messageProducer.send(messageToSend);
... and just subsequent create a Consumer on the SAME Session and topic (topicSend is equal as tempTopic
MessageConsumer messageConsumer = session.createConsumer(tempTopic, MESSAGE_SELECTOR);
Yes. That should be fine. Just be sure to close your producer if you're done with it.