I'm trying out the sample code from this page to test publishing messages to a WSO2 Message Broker:
https://docs.wso2.com/display/MB310/Sending+and+Receiving+Messages+Using+Queues
The sample code appears to connect -> publish -> disconnect.
I assume this isn't the typical design for production code. I tried reducing the code that is invoked every time I publish a message (several times a second), but it looks like the connection is dropped and never re-established:
public void publishMessage(String msg) throws NamingException, JMSException {
TextMessage textMessage = topicSession.createTextMessage(msg);
topicPublisher.publish(textMessage);
}
javax.jms.IllegalStateException: Object org.wso2.andes.client.AMQSession_0_8@79aa1855 has been closed
Do I need to reconnect every time I publish a message?