Transactions within XMS beta - Websphere

This is a discussion on Transactions within XMS beta - Websphere ; I'm playing with the newish XMS Beta V1.1 (Beta Refresh 1). Is there any chance that the implementation of the (first) boolean parameter in: ISession CreateSession(Boolean transacted, AcknowledgeMode acknowledgeMode); has been inverted when compared to java JMS and the XMS ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Transactions within XMS beta

  1. Transactions within XMS beta

    I'm playing with the newish XMS Beta V1.1 (Beta Refresh 1). Is there any chance that the implementation of the (first) boolean parameter in:

    ISession CreateSession(Boolean transacted, AcknowledgeMode acknowledgeMode);

    has been inverted when compared to java JMS and the XMS spec?

    I am finding that if I set it to ?true? and then do an explicit commit or rollback it gives me an invalid state error ? you can?t commit in this state. Conversely. when I use ?false? I?m allowed to do an explicit rollback or commit. If I fail to do so, the messages reappear on the queue when the app quits.

    My understanding was that 'true' meant that it is meant to be transacted by the user.



  2. Re: Transactions within XMS beta

    John,

    Please could you provide a compact testcase? thanks.

    We have made significant changes since the beta refresh, and the new release
    is due soon. It will be released as a Category 2 SupportPac.

    Regards,
    Saket



  3. Re: Transactions within XMS beta

    Hi,

    This isn't something we're currently aware of but to help us take a look
    would you be able to answer the following?

    - What type of messaging server are you connected to?
    - At what point in the code is the commit call made - is this within an
    async message handler?
    - Are there any more details associated with the exception (i.e. any linked
    exception, stacktrace etc)?

    Any other info that your able to provide would also be much appreciated,
    such as a code extract that demonstrates the problem or some trace data
    (this can be retrieved from the working dir after setting the environment
    variable XMS_TRACE_ON=1 before the app is run - there's further help in the
    manual for this if your able to try it).

    All the best,
    Charlie


    "John Watson" wrote in message
    news:1897432758.1141057473965.JavaMail.wassrvr@lts gwas007.sby.ibm.com...
    > I'm playing with the newish XMS Beta V1.1 (Beta Refresh 1). Is there any

    chance that the implementation of the (first) boolean parameter in:
    >
    > ISession CreateSession(Boolean transacted, AcknowledgeMode

    acknowledgeMode);

    >
    > has been inverted when compared to java JMS and the XMS spec?
    >
    > I am finding that if I set it to ?true? and then do an explicit commit or

    rollback it gives me an invalid state error ? you can?t commit in this
    state. Conversely. when I use ?false? I?m allowed to do an explicit rollback
    or commit. If I fail to do so, the messages reappear on the queue when the
    app quits.
    >
    > My understanding was that 'true' meant that it is meant to be transacted

    by the user.
    >
    >




  4. Re: Transactions within XMS beta

    Thanks for the prompt response.

    It'll take me a little while to build a tiny test case, but I'll try to find time to do so. In the meantime some further info:- I'm connecting to an IBM Websphere MQ 6.0 Queue Manager running on Windows 2000. I am using the simple 'on message' async callback. The commit/rollback is performed within this handler.

    I retrieve one message at a time within a transaction and am attempting to commit (or roll back) each one individually. When I said I got the 'invalid state error' this was not thrown as an exception but merely logged to the console.

    I'll attempt to trace the program later on today (I hope) and will post the details.

    John

  5. Re: Transactions within XMS beta

    Here's a sample test case. Using it, after each dequeue, the following is output to the console:

    Exception : IBM.XMS.IllegalStateException: CWSMQ0062E: This session is Transacted.
    FFDC to xmsffdc2720_2006.02.28T13.57.21.txt

    Note that the transaction parameter is true and I am attempting explicit commit and rollback. The bindings file stuff just sets up the location of a standard file-based JNDI holding the name of the queue connection factory and queue

    using System;
    using System.Configuration;
    using System.Collections;
    using System.Text;


    using IBM.XMS;

    namespace com.sis.xupdate.listener
    {
    ///
    /// Summary description for XupListener
    ///

    class XupListener
    {
    // the lg4net logger

    // the MQ session
    public static ISession QueueSession = null;

    static void OnNewMessageCallback(IMessage message)
    {
    Console.WriteLine("got message");
    try
    {
    string bodyString = null;
    if (message is ITextMessage)
    {
    ITextMessage textMessage = (ITextMessage)message;
    Console.WriteLine("This is a text message");
    bodyString = textMessage.Text;
    }
    else
    {
    IBM.XMS.IBytesMessage myTM = (IBM.XMS.IBytesMessage)message;
    byte[] myByteArray = new byte[myTM.BodyLength];
    myTM.ReadBytes(myByteArray);
    UTF8Encoding mUtf8Encoding = new UTF8Encoding();
    char[] characters = mUtf8Encoding.GetChars(myByteArray);
    bodyString = new string(characters);
    }
    Console.WriteLine("body:" + bodyString);


    SafeCommit();
    }
    catch(XMSException e)
    {
    Console.WriteLine("XMS Exception processing message: ", e);
    Exception e1 = e.LinkedException;
    if (null != e1)
    {
    Console.WriteLine("Linked Exception :" + e1.Message);
    }
    SafeRollback();
    }
    catch(Exception e)
    {
    Console.WriteLine("Unexpected Exception processing message: ", e);
    SafeRollback();
    }

    }

    private static void SafeCommit()
    {
    try
    {
    QueueSession.Commit();
    }
    catch (Exception e)
    {
    }
    }

    private static void SafeRollback()
    {
    try
    {
    QueueSession.Rollback();
    }
    catch (Exception e)
    {
    }
    }

    ///
    /// The main entry point for the application.
    ///

    [STAThread]
    static void Main(string[] args)
    {

    //construct the path to the bindings file
    // I can only get absolute URLs to work here
    string BindingsFilePath = @"file://" + ConfigurationSettings.AppSettings["BindingsDir"] + @"\" +
    ConfigurationSettings.AppSettings["BindingsFileName"];


    string ConnectionFactoryName = ConfigurationSettings.AppSettings["ConnectionFactory"];
    string QueueName = ConfigurationSettings.AppSettings["QueueName"];

    Hashtable aHashtable = new Hashtable();
    aHashtable.Add("XMSC_IC_URL", BindingsFilePath);

    try
    {
    InitialContext jndi = new InitialContext(aHashtable);

    IDestination queueObject = (IDestination)jndi.Lookup(QueueName);
    IConnectionFactory QueueManager = (IConnectionFactory)jndi.Lookup(ConnectionFactoryN ame);

    IConnection QueueConnection = QueueManager.CreateConnection();

    // we try 'true' here because we think it should mean WE do the transaction commit rollback
    //
    XupListener.QueueSession = QueueConnection.CreateSession(true, AcknowledgeMode.AutoAcknowledge);

    IMessageConsumer QueueConsumer = XupListener.QueueSession.CreateConsumer(queueObjec t);

    MessageListener messageListener = new MessageListener(OnNewMessageCallback);
    QueueConsumer.MessageListener = messageListener;

    Console.WriteLine("Connected to queue: " + QueueName);

    // Start the connection
    QueueConnection.Start();
    }
    catch (XMSException e)
    {
    Console.WriteLine("XMSException :" + e.Message);
    Exception e1 = e.LinkedException;
    if (null != e1)
    {
    Console.WriteLine("Linked Exception :" + e1.Message);
    }
    }
    catch (Exception e)
    {
    Console.WriteLine("Exception: " + e.Message);
    }

    }
    }
    }


  6. Re: Transactions within XMS beta

    Hi John,

    Sorry that I missed your earlier thread. I have actually also encountered this problem - can you confirm it happens in the following scenario?

    - Async receive mode
    - Session transacted

    I believe this has been confirmed as a bug that will be fixed in the next release. This problem won't happen if either a.) you're not using session transacted or b.) you use Synchronous reception.

    Either way, I was told this should be fixed in the release which is due shortly.

    Thanks,

    Mark

  7. Re: Transactions within XMS beta

    Hi - thanks, Mark. Yes I can confirm. Sounds like the same bug. Thanks goodness - thought I was being stupid at first!

    John

  8. Re: Transactions within XMS beta

    Sorry John for the delay in reply. I concur with Mark.

    Thanks,
    Saket

    "John Watson" wrote in message
    news:739902796.1141148107875.JavaMail.wassrvr@ltsg was007.sby.ibm.com...
    > Hi - thanks, Mark. Yes I can confirm. Sounds like the same bug. Thanks
    > goodness - thought I was being stupid at first!
    >
    > John




+ Reply to Thread