ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ Installation/Configuration SupportWritting MQClient: Changin the C++ client to Java Client....

Post new topicReply to topic
Writting MQClient: Changin the C++ client to Java Client.... View previous topic :: View next topic
Author Message
Praveen
PostPosted: Sat Dec 21, 2002 1:51 am Post subject: Writting MQClient: Changin the C++ client to Java Client.... Reply with quote

Apprentice

Joined: 23 Oct 2002
Posts: 40
Location: Bangalore

Hi All,
I am trying to change my existing C++ MQClient to Java Client, I am having the following doubts..

Code:
/*   Declare MQI structures needed                                */
    MQOD    TQod = {MQOD_DEFAULT};   /* Target Queue Object Descriptor*/
    MQOD    RQod = {MQOD_DEFAULT};   /* Reply Queue Object Descriptor */
    MQMD    md = {MQMD_DEFAULT};     /* Message Descriptor            */
    MQMD    Rmd = {MQMD_DEFAULT};    /* Reply Message Descriptor      */
    MQPMO   pmo = {MQPMO_DEFAULT};   /* put message options           */
    MQGMO   gmo = {MQGMO_DEFAULT};   /* get message options           */


Ex : Here we can add strncpy(TQod.ObjectName, “SEND.QUEUE”);

Code:
MQCONN(QMName,                  /* queue manager                  */
               &Hcon,                   /* connection handle              */
               &CompCode,               /* completion code                */
               &CReason);               /* reason code                    */


MQOPEN(Hcon,                      /* connection handle                       */
           &TQod,                     /* object descriptor for Target Queue      */
           O_options,                 /* open options                            */
           &TQHobj,                   /* Target Queue object handle              */
           &TQOpenCode,               /* MQOPEN completion code for Target Queue */
           &Reason);                  /* reason code                             */


MQPUT(Hcon,                              /* connection handle               */
          TQHobj,                            /* Target Queue object handle      */
          &md,                               /* message descriptor              */
          &pmo,                              /* default options (datagram)      */
          buflen,                            /* buffer length                   */
          (void *) strMessage,               /* message data                    */
          &CompCode,                         /* completion code                 */
          &Reason);                          /* reason code                     */




In my C++ program I am having a setup like this. How should I do the same thing in java?? I,e what is the equivalent of MQOD, MQMD, MQPMO, MQGMO so that I can add the required parameters to them.
What I want to do is I will create one Message object, which will be having all the parameters, like queue name, queue manager name, userId and the message string and I want to send the whole object as the input to the MQClient. Is it possible to do like this?? . If so, can anybody please tell me how can I program this.
Thanks in advance for your help..
_________________
Thanks,

Praveen K
Back to top
View user's profile Send private message
vennela
PostPosted: Sat Dec 21, 2002 2:55 am Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Praveen:

Refer to the MQ Programming Using Java manual. You are sure to get most of such information there. For answers to your question about equivalent classes see Chapter 9 (Websphere MQ base java classes and interfaces). Also there are a few examples in the repository that will help you understand MQ Java programming.

MQPMO's equivalent is com.ibm.mq.MQPutMessageOptions class in Java
MQGMO --> com.ibm.mq.MQGetMessageOptions
MQOD ---> com.ibm.mq.MQManagedObject
etc.

Another source for some samples is http://www.developer.ibm.com/tech/sampmq.html

Hope this helps

---
Venny
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Praveen
PostPosted: Sat Dec 21, 2002 4:38 am Post subject: Reply with quote

Apprentice

Joined: 23 Oct 2002
Posts: 40
Location: Bangalore

Venny,
Thanks for you inputs and suggestions.. I am going through those examples.
But when you are putting the messages according to the MQMessagePut, we need to send different objects like TQod which includes the Queue Manager name and Queue name, 'md' (message descriptor) to set the user id, passwd, messageId and a message and pass these things as a input to MQMessagePut. It holds good same for the MQMessageGet also. But is it fine if I build one single object which contains all the information like QM, Queue, UserId, and Message and send this object as the input to the MQMessagePut and get the reply back.
Why I want to do like this is because, in my application depending on the messages I will be sending these messages to different queues in that case I am planning to build the object which contains all the configuration parameters and the messageString and send this to the client. Is it possible for the Client to recongnise depending on this object to which queue (object contains all the info about QM and queues) it has to send the message. If this is not correct can you please suggest me some alternative for this, so that it should be very generic.
It would be very helpful for me if you send some more examples.. Sorry for the long mail..
_________________
Thanks,

Praveen K
Back to top
View user's profile Send private message
Praveen
PostPosted: Sun Dec 22, 2002 4:19 am Post subject: Reply with quote

Apprentice

Joined: 23 Oct 2002
Posts: 40
Location: Bangalore

Venny,
For my last question I got the answer, I will be getting all the parameters in my client program and will be passing to the MQMessagePut.
Ex: 'MessageObject' is the my single object which contains all the paramerters. So I will get each like this..
MessageObject.QueueManager
MessageObject.Queue
MessageObject.getUserId.
Can you tell me how exactly I need to use MQManagedObject and MQMD to set these values..? Can you please send me some examples which tells how to use these things.. I have not found any examples which are making use of these things in that site which u had sent.
_________________
Thanks,

Praveen K
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ Installation/Configuration SupportWritting MQClient: Changin the C++ client to Java Client....
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.