Author |
Message
|
mattfarney |
Posted: Thu Dec 29, 2011 4:43 pm Post subject: Missing sample code |
|
|
 Disciple
Joined: 17 Jan 2006 Posts: 167 Location: Ohio
|
I was looking for the sample code on the IBM website for changing a C++ connection from server to client.
I found this: Sample program HELLO WORLD (imqwrld.cpp)
which talks about both a imqwrlds and imqwrldc file.
The sample code in that help page (as best as I can tell) is the imqwrlds one.
Any clue where I can find the sample code for imqwrldc?
-mf |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Dec 29, 2011 7:16 pm Post subject: Re: Missing sample code |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mattfarney wrote: |
I was looking for the sample code on the IBM website for changing a C++ connection from server to client.
I found this: Sample program HELLO WORLD (imqwrld.cpp)
which talks about both a imqwrlds and imqwrldc file.
The sample code in that help page (as best as I can tell) is the imqwrlds one.
Any clue where I can find the sample code for imqwrldc?
-mf |
You're probably better off calling the C routines from C++.
I believe the C++ interface is being deprecated...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Dec 31, 2011 8:17 am Post subject: Re: Missing sample code |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
fjb_saper wrote: |
mattfarney wrote: |
I was looking for the sample code on the IBM website for changing a C++ connection from server to client.
I found this: Sample program HELLO WORLD (imqwrld.cpp)
which talks about both a imqwrlds and imqwrldc file.
The sample code in that help page (as best as I can tell) is the imqwrlds one.
Any clue where I can find the sample code for imqwrldc?
-mf |
You're probably better off calling the C routines from C++.
I believe the C++ interface is being deprecated...  |
It's not deprecated. it's just stablized, so it hasn't been updated since somewhere in the v.6 lifecycle. i.e. it won't have any support for features of v7.
The source for a client application is usually not significantly different than the source for a server application, except for potentially handling different return codes/exception types. The main difference is the compiling/linking step. So the imqwrld.cpp is the source file for both imqwrld and imqwrldc binaries, compiled and linked against different libraries.
But again, don't use the C++ API for new applications. |
|
Back to top |
|
 |
mattfarney |
Posted: Tue Jan 03, 2012 3:31 pm Post subject: |
|
|
 Disciple
Joined: 17 Jan 2006 Posts: 167 Location: Ohio
|
Unfortunately, I need the different part. I need to change a working C++ application from server to client connectivity.
Is my understanding correct?
1. I'll need to create an IMQChannel object with the SVRCONN name as the name, the IP:port as the connection, and TCP as the transport type.
2. On the IMQQueueManager object, I'll need to use that IMQChannel in a setChannelReference call before trying to connect.
Am I missing anything? (I'm aware I'll have to change the linkage to the client libraries.)
-mf |
|
Back to top |
|
 |
mvic |
Posted: Tue Jan 03, 2012 5:10 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
Have you tried just
- using the MQSERVER environment variable
or
- using a CCDT
Possibly these help avoid the need for a code change. You will need to link with imqc instead of imqs, as you already mentioned. |
|
Back to top |
|
 |
mattfarney |
Posted: Tue Jan 03, 2012 10:35 pm Post subject: |
|
|
 Disciple
Joined: 17 Jan 2006 Posts: 167 Location: Ohio
|
I already have some related code to change so I'm leaning towards modifying the code to do it directly.
-mf |
|
Back to top |
|
 |
mattfarney |
Posted: Wed Jan 04, 2012 5:34 pm Post subject: |
|
|
 Disciple
Joined: 17 Jan 2006 Posts: 167 Location: Ohio
|
As I try to proof of concept, I come up with more and more questions.
1. Does a normal server install include the client libraries? [I've seen boxes where they are all there and some where they aren't.]
2. When I try and connect with the above plan, I end up with an MQ2012 environment error. Given that there are no options (at least that I can find) to choose between client/server connectivity on the individual objects, how is MQ deciding that I have mis-linked my libraries?
3. For the MQSERVER environment variable, is it common to set it for the entire server or have the application set it during setup?
-mf |
|
Back to top |
|
 |
mattfarney |
Posted: Wed Jan 04, 2012 5:44 pm Post subject: |
|
|
 Disciple
Joined: 17 Jan 2006 Posts: 167 Location: Ohio
|
Ignore question #2. The FDC told me the problem (conflicting libraries in the runtime environment).
-mf |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 04, 2012 10:17 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mattfarney wrote: |
3. For the MQSERVER environment variable, is it common to set it for the entire server or have the application set it during setup?
-mf |
Multiple applications, potentially a different value per application for the environment variable. I'd set it in the shell/script calling the client program... and output its value into the program log...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Jan 05, 2012 5:43 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
mattfarney wrote: |
1. Does a normal server install include the client libraries? [I've seen boxes where they are all there and some where they aren't.] |
Its up to the person installing Websphere MQ on the server. The MQ Client libraries are optional during an install of full Websphere MQ.
I generally include them. Unless its a system where you want to restrict connectivity options to other systems, and/or you want to minimize the installation footprint. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
vennela |
Posted: Wed Jan 18, 2012 5:30 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
fjb_saper wrote: |
mattfarney wrote: |
3. For the MQSERVER environment variable, is it common to set it for the entire server or have the application set it during setup?
-mf |
Multiple applications, potentially a different value per application for the environment variable. I'd set it in the shell/script calling the client program... and output its value into the program log...  |
OR
Use it in your program directly using MQCONNX |
|
Back to top |
|
 |
|