RC 2039 means you are trying to do a PUT but to a queue  that you have not opened for output.   So, remove MQC.MQOO_INPUT_AS_Q_DEF from your #2 program and give it a try again.
 
Regards,
 
Ruzi

Srinivas Amarnadh <[EMAIL PROTECTED]> wrote:

Hi

I am trying to do two thing

#1

One thread is reading a Queue continuously. I am checking whether the messages are available in the queue or not by using a method currentDepth(). If messages are available reading the messages else do nothing.

Here is the code used to open queue and get message.

MQQueue aMQLocalQueue       =null;

      int iOpenOptionsLocal;

     

      public MQReaderThread()

      {

                                    iOpenOptionsLocal =   MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE ;

      }

     

      public void _openConnection()

      {

            try

            {

                        System.out.println("Connecting...");

                        MQEnvironment.hostname=strHostname;

                        MQEnvironment.port=1414;

                        MQEnvironment.channel=strChannel;

                        MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);

                        aMQManager=new MQQueueManager(strQManager);

                        aMQLocalQueue=aMQManager.accessQueue(strLocalQueue,      iOpenOptionsLocal,null,null,null); 

                        System.out.println("Connection Opened.");

           

            }

            catch (Exception e)

            {

                  e.printStackTrace();

            }

           

      }

#2

While running the first program I am executing the second program which put the messages on the same queue.

Here is the code to put the message.

int iOpenOptionsLocal;

  public MYMQTest()

  {

   iOpenOptionsLocal= MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ;

  }

  public void openConnection()

  {

 

      try{

        MQEnvironment.hostname      =strHostname;

        MQEnvironment.port          =1414;

        MQEnvironment.channel       =strChannel;

        MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);

        aMqm=new MQQueueManager(strQManager);

 

        System.out.println("Inside Connection Opened.");

        aMqlqueue=aMqm.accessQueue(strLocalQueue,iOpenOptionsLocal,null,null,null);

       // aMqlqueue=aMqm.accessQueue("SYSTEM.DEFAULT.LOCAL.QUEUE",iOpenOptionsLocal,null,null,null);

        System.out.println("Connection Opened.");

        }

        catch(Exception e)

        {

          e.printStackTrace();

        }

  }

 

I tried with different open options, but I couldn't get the solutions.

I am getting a MQException with the id 2039.

 

Can any one clearly explain what could be the problem?

 

 

Thanks and regards

 

M.Srinivas Amarnadh

iflex Solutions Ltd.,

Millenium Towers,

Kundalahalli Main Road,

Bangalore - 560 037.

Phone : 57596000 , 22086000

Extn - 6616

 

Reply via email to