Topic
5 replies Latest Post - ‏2006-02-07T14:13:52Z by SystemAdmin
SystemAdmin
SystemAdmin
684 Posts
ACCEPTED ANSWER

Pinned topic MQe with JMS: Messages do get send out only first time

‏2005-12-02T07:58:14Z |
Hi,

I am trying to use the JMS interface for MQe (2.0.2.0). I have only one
async remote queue.
Whatever I try, only the first time (that is with the first message
submitted) messages do get send out, subsequent messages are only sent
out after a complete close and restart.
I tried already:
  • using either tcpiplength or udpbasic adapter
  • using a MQeQueueManagerRule that start a background thread for calling
triggerTransmission (and also implements transmit(MQeQueueProxy)
according to
news://news.software.ibm.com:119/dmght0$9o8g$1@news.boulder.ibm.com )
  • starting a triggerTransmission background thread without a
MQeQueueManagerRule
  • using stop and start for a restart

transmit(MQeQueueProxy) is only called for the first message (and any
messages already waiting at startup).

Test environment is WXP, target environment will be PocketPC.

Any suggestions?

Thanks,
Wolfgang
Updated on 2006-02-07T14:13:52Z at 2006-02-07T14:13:52Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    684 Posts
    ACCEPTED ANSWER

    Re: MQe with JMS: Messages do get send out only first time

    ‏2005-12-02T07:58:14Z  in response to SystemAdmin
    Hi,

    I am not still not clear with the setup you have?
    What JVM are you using for JMS in PocketPC?
    And how is it being configured?
    One thing to be taken care in this scenario is you cannot mix both MQe
    API and JMS in an application.
    The recommended way is to write an application is use MQe or use JMS/MQe
    JMS.

    regards,
    Vijay
    "Wolfgang Röckelein" <mail@wolfgangroeckelein.de> wrote in message
    news:dmouo4$9du2$1@news.boulder.ibm.com...
    > Hi,
    >
    > I am trying to use the JMS interface for MQe (2.0.2.0). I have only one
    > async remote queue.
    > Whatever I try, only the first time (that is with the first message
    > submitted) messages do get send out, subsequent messages are only sent
    > out after a complete close and restart.
    > I tried already:
    > - using either tcpiplength or udpbasic adapter
    > - using a MQeQueueManagerRule that start a background thread for calling
    > triggerTransmission (and also implements transmit(MQeQueueProxy)
    > according to
    > news://news.software.ibm.com:119/dmght0$9o8g$1@news.boulder.ibm.com )
    > - starting a triggerTransmission background thread without a
    > MQeQueueManagerRule
    > - using stop and start for a restart
    >
    > transmit(MQeQueueProxy) is only called for the first message (and any
    > messages already waiting at startup).
    >
    > Test environment is WXP, target environment will be PocketPC.
    >
    > Any suggestions?
    >
    > Thanks,
    > Wolfgang

    • SystemAdmin
      SystemAdmin
      684 Posts
      ACCEPTED ANSWER

      Re: MQe with JMS: Messages do get send out only first time

      ‏2005-12-02T09:43:32Z  in response to SystemAdmin
      vijay wrote:
      > I am not still not clear with the setup you have?

      Currently I am testing on WXP, J9 1.4.1

      > What JVM are you using for JMS in PocketPC?

      I will be using J9 with Foundation Profile.

      > And how is it being configured?

      see below.

      > One thing to be taken care in this scenario is you cannot mix both MQe
      > API and JMS in an application.
      > The recommended way is to write an application is use MQe or use JMS/MQe
      > JMS.

      Does that mean that I can't use MQeQueueManagerRule with an background
      thread calling triggerTransmission?

      What I am currently using for tests is:
      QueueConnectionFactory factory = new
      MQeQueueConnectionFactory(mqeRootDir + mqeClientName + ".ini");

      connection = factory.createQueueConnection();
      connection.setExceptionListener(this);
      connection.start();
      QueueSession session =
      connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
      Queue queue = session.createQueue(jmsServerName + "+" + jmsQueueName);
      QueueSender sender = session.createSender(queue);
      TextMessage outMessage = session.createTextMessage("Testnachricht");
      sender.send(outMessage);
      Thread.sleep(50000);
      outMessage = session.createTextMessage("Testnachricht2");
      sender.send(outMessage);
      Thread.sleep(50000);
      connection.close();

      For creating the QueueManager I use:

      MQeFields parms = new MQeFields();
      MQeFields queueManagerParameters = new MQeFields();
      queueManagerParameters.putAscii(MQeQueueManager.Name, mqeClientName);
      parms.putFields(MQeQueueManager.QueueManager, queueManagerParameters);
      MQeFields registryParameters = new MQeFields();
      registryParameters.putAscii(MQeRegistry.DirName, mqeRootDir +
      mqeClientName + java.io.File.separator + "Registry");
      parms.putFields(MQeQueueManager.Registry, registryParameters);
      String queueStore = "MsgLog:" + mqeRootDir + mqeClientName +
      java.io.File.separator + "Queues";
      MQeQueueManagerConfigure qmConfig = new MQeQueueManagerConfigure(parms,
      queueStore);
      qmConfig.defineQueueManager();
      qmConfig.defineDefaultSystemQueue();
      qmConfig.defineDefaultDeadLetterQueue();
      qmConfig.defineDefaultAdminReplyQueue();
      qmConfig.defineDefaultAdminQueue();
      qmConfig.close();
      MQeQueueManager localQM = new MQeQueueManager(mqeClientName, mqeRootDir
      + mqeClientName + java.io.File.separator + "Registry");
      MQeConnectionAdminMsg connectionMessage = new MQeConnectionAdminMsg();
      connectionMessage.setName("Server_AP122");
      connectionMessage.addAlias("Server");
      connectionMessage.create("com.ibm.mqe.adapters.MQeTcpipLengthAdapter:" +
      serverIP + ":1881",null,null,"Default Channel","");
      localQM.putMessage( mqeClientName,
      MQe.Admin_Queue_Name,
      connectionMessage,
      null,
      0);
      MQeRemoteQueueAdminMsg msg = new MQeRemoteQueueAdminMsg();
      MQeFields params = new MQeFields();
      msg.setName("Server", "Server");
      params.putByte(MQeQueueAdminMsg.Queue_Mode,MQeQueueAdminMsg.Queue_Asynchronous);
      params.putAscii(MQeQueueAdminMsg.Queue_FileDesc,queueStore);
      msg.create(params);
      localQM.putMessage( mqeClientName,
      MQe.Admin_Queue_Name,
      msg,
      null,
      0);
      Thread.sleep(10000);
      localQM.close();

      Any ideas?

      Thanks,
      Wolfgang
      • SystemAdmin
        SystemAdmin
        684 Posts
        ACCEPTED ANSWER

        Re: MQe with JMS: Messages do get send out only first time

        ‏2005-12-02T11:25:00Z  in response to SystemAdmin
        Hi,

        when I use MQe directly, it works:
        MQeFields sections = MQeQueueManagerUtils.loadConfigFile(mqeRootDir +
        mqeClientName + ".ini");
        MQeQueueManagerUtils.processAlias(sections);
        queueManager = MQeQueueManagerUtils.processQueueManager(sections);

        MQeMsgObject msgObj1 = new MQeMsgObject();
        msgObj1.putAscii("MsgData", "Testnachricht1");
        queueManager.putMessage(jmsServerName, jmsQueueName, msgObj1, null, 0);
        Thread.sleep(20000);
        msgObj1 = new MQeMsgObject();
        msgObj1.putAscii("MsgData", "Testnachricht2");
        queueManager.putMessage(jmsServerName, jmsQueueName, msgObj1, null, 0);
        Thread.sleep(50000);
        queueManager.close();

        Both messages get delivered to the server.

        Wolfgang
        • SystemAdmin
          SystemAdmin
          684 Posts
          ACCEPTED ANSWER

          Re: MQe with JMS: Messages do get send out only first time

          ‏2006-01-25T21:32:03Z  in response to SystemAdmin
          Wolfgang Röckelein wrote:
          > Hi,
          >
          > when I use MQe directly, it works:
          > MQeFields sections = MQeQueueManagerUtils.loadConfigFile(mqeRootDir +
          > mqeClientName + ".ini");
          > MQeQueueManagerUtils.processAlias(sections);
          > queueManager = MQeQueueManagerUtils.processQueueManager(sections);
          >
          > MQeMsgObject msgObj1 = new MQeMsgObject();
          > msgObj1.putAscii("MsgData", "Testnachricht1");
          > queueManager.putMessage(jmsServerName, jmsQueueName, msgObj1, null, 0);
          > Thread.sleep(20000);
          > msgObj1 = new MQeMsgObject();
          > msgObj1.putAscii("MsgData", "Testnachricht2");
          > queueManager.putMessage(jmsServerName, jmsQueueName, msgObj1, null, 0);
          > Thread.sleep(50000);
          > queueManager.close();
          >
          > Both messages get delivered to the server.
          >
          > Wolfgang
          Hi,

          There is a limitation with WMQe JMS. If your application starts
          Queue manager using JMS API and closes using MQe API, you will never be
          able to start the QMGr using JMS. This is because JMS API for MQe
          maintains a internal reference to queue manager, if qmanager closed by
          MQe API ( i.e queueManager.close) JMS will get confused.

          In order to start JMS, you have restart you JVM.

          The best way to solve the problem is to create the necessary qmgr
          objects (registry, queues etc) as a one time setup. Later use the same
          qmgr to send/receive messaging using JMS, and never call
          queueManager.close in your JMS app, instead use Connection.stop() that
          will shutdown the qmgr running in the same JVM.

          Hope this helps you.

          Regards
          Arun
          • SystemAdmin
            SystemAdmin
            684 Posts
            ACCEPTED ANSWER

            Re: MQe with JMS: Messages do get send out only first time

            ‏2006-02-07T14:13:52Z  in response to SystemAdmin
            Arun wrote:
            > There is a limitation with WMQe JMS. If your application starts
            > Queue manager using JMS API and closes using MQe API, you will never be
            > able to start the QMGr using JMS. This is because JMS API for MQe
            > maintains a internal reference to queue manager, if qmanager closed by
            > MQe API ( i.e queueManager.close) JMS will get confused.
            >
            > In order to start JMS, you have restart you JVM.
            >
            > The best way to solve the problem is to create the necessary qmgr
            > objects (registry, queues etc) as a one time setup. Later use the same
            > qmgr to send/receive messaging using JMS, and never call
            > queueManager.close in your JMS app, instead use Connection.stop() that
            > will shutdown the qmgr running in the same JVM.

            I did this exactly in this way, see
            news://news.software.ibm.com:119/dmp4tu$3s44$1@news.boulder.ibm.com

            I the things mentioned in
            news://news.software.ibm.com:119/dmouo4$9du2$1@news.boulder.ibm.com
            independendly of each other.

            MQe was giving no errors when used exclusivly through the JMS api. It
            just wouldn't send any more messages after the first one until a VM restart.

            I am now using the MQe API directly...

            Regards,
            Wolfgang