Author |
Message
|
ydsk |
Posted: Mon Feb 19, 2007 7:43 pm Post subject: C/mq code inside C++ functions |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
Hi,
We have this scenario:
C++ main program on Windows <---calls---> C++ functions on a SECOND Windows machine<----which in turn calls----> 3 C++ functions on a THIRD windows machine <----interact with --> a proprietary middleware on Unix <--which in turn interacts with----> IMS on mainframe.
The 3 C++ functions respectively perform (1) connect once, (2) send n receive multiple messages, and (3) disconnect, to the existing middleware.
It's a request-response scenario.
We need to replace the proprietary middleware with MQ on Unix.
This will reult in MQ on the mainframe side with IMS bridge.
This will also result in a MQ/C++ client on the third windows box above.
We are asked to change only the code inside the 3 C++ functions on the THIRD windows box above as the proprietary middleware has been replaced with MQ. We aren't supposed to touch the remaining C++ code on the remaining Windows boxes.
I am thinking I can only use C/MQ code in the 3 C++ functions to deal with MQ. I don't think I can code them in C++/MQ because if I instantiate MQ qmgr/queue objects in the connect function the objects won't be visible to the other 2 functions for further processing ( I can't pass them by reference/value as I can't change the calling functions on other windows boxes ).
Is my approach ok ? Can someone pls suggest.
Thanks.
ydsk. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 19, 2007 7:45 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You should replace all of the networking between machines with MQ. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ydsk |
Posted: Tue Feb 20, 2007 5:10 am Post subject: |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
Jeff,
I am a contractor and I can't change the direction.
But do we have to replace the networking on all Windows machines ? I don't think so.
I think replacing the networking on the THIRD windows box should be sufficient.
Pls let me know if not.
Thanks.
ydsk. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Feb 20, 2007 5:19 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Sufficient for what? For the client? I guess so.
Otherwise, it's entirely possible to isolate MQ behind an interface like you're talking about, and it doesn't require that you use C or C++.
It merely requires that you do all MQ programming on the "third" box, and honor the interface to the other machines.
In fact, this is a fairly common kind of pattern in web programming (NOT necessarily JAVA programming). Clients make HTTP calls to a web server, which pass them over HTTP to an application server, which then make MQ calls to back end servers. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ydsk |
Posted: Tue Feb 20, 2007 10:51 am Post subject: |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
We need do the same thing: All MQ programming is to be done on the third box as we can't change the code on any other box.
We are asked to modify only the 3 existing C++ functions on the third box ( their names and interfaces are fixed - we can't change them as they are being called by the functions on the second box which we can't modify).
We are planning to declare Hconn, and Hobj as global variables to the 3 functions on third box since we can't connect to the qmgr in one function and pass the handle to the other 2.
In C++, we have to declare them in a class which global to the 3 functions, and is not really an object oriented way of doing things.
The issue here is to decide whether all MQ programming in the 3 functions should be done using C++ itself ( though not really object oriented as just mentioned) or using C ( the 3 functions themselves are being called from other C++ functions on the second box as mentioned above).
Any thoughts are appreciated. |
|
Back to top |
|
 |
kevinf2349 |
Posted: Tue Feb 20, 2007 11:26 am Post subject: |
|
|
 Grand Master
Joined: 28 Feb 2003 Posts: 1311 Location: USA
|
As Jeff says
jefflowrey wrote: |
Otherwise, it's entirely possible to isolate MQ behind an interface like you're talking about, and it doesn't require that you use C or C++.
It merely requires that you do all MQ programming on the "third" box, and honor the interface to the other machines.
In fact, this is a fairly common kind of pattern in web programming (NOT necessarily JAVA programming). Clients make HTTP calls to a web server, which pass them over HTTP to an application server, which then make MQ calls to back end servers. |
The only 'difficult' part of all this is working out how to interact with the other box. I assume you are going to use TCP/IP sockets?
The 3 programs don't have to be C++...that is a site (business) decision to make. If the client wants C++ then that is what you should deliver. If you have a choice then code them in whatever works for you.
Hope this helps |
|
Back to top |
|
 |
ydsk |
Posted: Tue Feb 20, 2007 1:05 pm Post subject: |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
We were asked to code the 3 functions in C++.
I particularly asked about C because C++ natively supports C, and we can use C/MQ code inside the 3 C++ functions by just including a "extern C" construct for the C header.
Thanks.
ydsk. |
|
Back to top |
|
 |
|