Hello,
we have a SLSB who register himself as producer of a topic, in post construct we create Conection, Session & Porducer, and in send() we call session.createObjectMessage():
@PostConstruct
public void postConstruct() {
try {
connection = connectionFactory.createTopicConnection();
session = connection.createSession(true, Session.SESSION_TRANSACTED);
producer = session.createProducer(destination);
producer.setTimeToLive(messageValidityPeriod * 60000);
} catch (final JMSException e) {
logger.error("unable to create JMS producer", e);
}
}
public void send(final Map<String, String> properties, final ProvisioningEvent event) {
try {
final ObjectMessage message = session.createObjectMessage();
message.setObject(event);
[...]
producer.send(message);
} catch (final JMSException e) {
if (logger.isInfoEnabled()) {
logger.info("JMSException: " + e.getMessage());
}
}
}
Connetction Factory is JmsXA.
It worked in JBAS50-CR2 (JBM 1.4.1-CR1 ?), but with JBAS5.0-GA it does not work anymore:
javax.jms.IllegalStateException: The session is closed
on calling session.createObjectMessage() in method send().
If the session is created in the method send, performances are really slowed down, due to a synchronization problem.
Please help
Ivan