🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Does solace topic support XA Transaction.

Richa
Richa Member Posts: 13 ✭✭
edited July 12 in General Discussions #1

Am successfully tested XA Transaction when sending message to a queue directly. But when publishing msg (with XA transaction only) to a topic which is subscribed a queue, behavior is different. So does solace topic support XA Transaction ? or its there only for queue ( like when sending msg directly to queue)

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 963 admin

    Hi @Richa,

    Since you're using XA transactions can you confirm you're using the JMS API?

    Can you share more information about the behaviour you're seeing with topics. XA transactions should support queues and topics as defined in the docs: https://docs.solace.com/API/Solace-JMS-API/Using-XA-Transactions.htm . I'd suggest taking a look through and seeing if things are setup as expected.

    Hope that helps!

  • Richa
    Richa Member Posts: 13 ✭✭
    edited July 15 #3

    Hi @marc ,

    Yes, am using JMS API only.

    I have integrated weblogic with solace using solace resource adapter and trying to send msg on solace topic (subscribed by queue) with XA Transaction. So as soon as "send" method get executed, msg get reflected in solace. Ideally, it should wait for transaction manager's confirmation msg to get changes effective (i.e 2PC) and get reflect on solace broker.

    Unlike topic, in case of queue (same queue which has subscription of above topic), msg get reflect only after transactional manager's confirmation at the end of my api. if any exception occurs post sending msg on solace and before my api completion, msg get rollback and does not show on solace (this is expected), which is not same in case of topic. (FYI- Queue direct-message is also disabled)

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 963 admin

    Thanks for the info @Richa.

    Can you maybe share the code skeleton? I want to make sure the XA session is being created and the transaction started before messages are sent.

    Something like this (pseduo code —> don't copy and paste)

    XASession session = connection.createXASession();
    Consumer c = session.createConsumer(...);
    session.getXAResource().start(...);  // start transaction before sending or receiving messages
    p.send(m);
    session.getXAResrouce().end(...);
    session.getXAResrouce().commit(...);
    


    thanks!

  • Richa
    Richa Member Posts: 13 ✭✭
    edited July 16 #5

    Hi @marc,

    PFB pseudo code that we are following:

    //using weblogic initial context factory to create initialContext
    ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup(...); // ConnectionFactory JNDI configured at weblogic
    Connection connection = connectionFactory.createConnection();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Topic topic = (Topic) initialContext.lookup(...); // Topic/Queue JNDI configured at weblogic as per destination type
    messageProducer.send(...); // sending msg on above topic/queue with persistent delivery mode

    Have used same code for Queue.

    FYI - ConnectionFactory is container-managed with XA Transaction support.

    Thanks!

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 963 admin

    Hey @Richa,

    Hmm. I don't think this will matter since the application server is involved here and might be overriding it with it's config but can you change the false in Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); to true. That currently means transacted=false

    Beyond that I'm out of ideas, can you open a support ticket? They'll be able to dig in deeper with you.

  • Richa
    Richa Member Posts: 13 ✭✭
    edited July 16 #7

    HI @marc,

    Yes, have tried with transacted=true also, but in that case, have to explicitly commit that session and then my application would no longer be a container managed.

    Sure, will try to open the support ticket for the same.

    Thankyou!