November 2018
Intermediate to advanced
388 pages
9h 5m
English
Consider the point-to-point messaging model that we created earlier with the Message type. We can enable transactions in the Producer class with JMSContext.SESSION_TRANSACTED as follows:
val jmsContext = connectionFactory .createContext(JMSContext.SESSION_TRANSACTED)
Our message Producer class looks as follows:
class Producer { @Inject private lateinit var initialContext: InitialContext fun sendMessage(message: String): String { try { val queue = initialContext .lookup("jms/PointToPointQueue") as Queue val connectionFactory = initialContext .lookup("jms/__defaultConnectionFactory") as ConnectionFactory val jmsContext = connectionFactory .createContext(JMSContext.SESSION_TRANSACTED) ...Read now
Unlock full access