Version 3

    JMS1.1 Enhancement


    One problem in JMS1.0.2b is that Queues and Topics have separate apis. This made it difficult to do work consistently on both objects.


    In fact it was only really possible using XASessions and two phase commit:


    // Send a message to a queue
    QueueConnection qc = queueConnectionFactory.createQueueConnection();
    QueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    QueueSender qp = qs.createSender(queue);
    // Send a message to a topic
    TopicConnection tc = topicConnectionFactory.createTopicConnection();
    TopicSession ts = tc.createSession(false, AUTO_ACKNOWLEDGE);
    TopicPublisher tp = ts.createPublisher(topic);


    The above code can only work consistently if sessions are really XASessions enlisted in the same transaction.


    With JMS 1.1 and the combinded api, the session can be used for both

    sends, even from a client transaction:


    // Send a message to a queue and topic in the same transaction
    Connection c = connectionFactory.createConnection();
    Session s = c.createSession(true, Session.SESSION_TRANSACTED);
    MessageProducer mpq = s.createProducer(queue);
    MessageProducer mpt = s.createProducer(topic);


    Now both sends either suceed or fail.