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 Index » IBM MQ Installation/Configuration Support » MQ Client Connection using C Programming

Post new topic  Reply to topic Goto page Previous  1, 2
 MQ Client Connection using C Programming « View previous topic :: View next topic » 
Author Message
aravindks3
PostPosted: Wed Jun 21, 2017 11:50 pm    Post subject: Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

The MQ team has made some changes to CCDT file and my amqsputc is working now. but my application is trying to connect using libmqm instead of libmqic.a library. So i need to check which library it is referring to.

Is there any way to find which library my application connects to?

aravindks3 wrote:
As per the CCDT file contents given by MQ team for me, i have tried same name.
So i have asked the MQ team to check revert me on the same. Waiting for their reply.
Will update you soon on the outcome after their reply.
Thanks for the response.


hughson wrote:
aravindks3 wrote:
My Library is linked to /usr/mqm/lib64/ which has following libraries
libmqicb_r.a , libmqicb.a, libmqic_r.a, libmqic.a.
Is there any other jar file to be present in the installation path.

You are writing a C application, Therefore jar files do not come into the equation.

Sounds like you only have the client libmqic* variants installed? That is fine though as you are trying to make a client connection anyway.

What QMgr name is your MQCONN call passing in? Does it match the QMNAME of an entry in your CCDT? (asterisks aside)

Cheers
Morag
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Jun 22, 2017 12:33 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

aravindks3 wrote:
The MQ team has made some changes to CCDT file and my amqsputc is working now. but my application is trying to connect using libmqm instead of libmqic.a library. So i need to check which library it is referring to.

Is there any way to find which library my application connects to?

So long as your MQ installation is MQ V7.1 or above, the libmqm library can make a client connection too. If you want to FORCE it to make a client connection instead of the default behaviour of trying a local connection first and if that fails trying a client connection, then set the following environment variable.

Code:
export MQ_CONNECT_TYPE=CLIENT

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
aravindks3
PostPosted: Thu Jun 22, 2017 1:23 am    Post subject: Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

Thanks for your prompt response.
My Websphere version is 7.5 still using libmqm, my application was referring to local queue manager and not client manager.
Till date, my application was referring to libmqm library. And my application has many programs which should run on local queue managers so this is fine.
Now only one program in my application has to refer libmqic library while compiling. So i am compiling my application twice once for all and once only for this particular program to point to libmqic and then edploying all at once.
It is working now.
May be i need to check now while compiling how to make sure only this file links to libmqic and all other files links to libmqm until the whole application migrates to use CCDT.

I will try the export you told and update you on the result.

Really appreciate your response and time taken.. Thank you very much.

hughson wrote:
aravindks3 wrote:
The MQ team has made some changes to CCDT file and my amqsputc is working now. but my application is trying to connect using libmqm instead of libmqic.a library. So i need to check which library it is referring to.

Is there any way to find which library my application connects to?

So long as your MQ installation is MQ V7.1 or above, the libmqm library can make a client connection too. If you want to FORCE it to make a client connection instead of the default behaviour of trying a local connection first and if that fails trying a client connection, then set the following environment variable.

Code:
export MQ_CONNECT_TYPE=CLIENT

Cheers
Morag
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Jun 22, 2017 2:38 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

aravindks3 wrote:
Thanks for your prompt response.
My Websphere version is 7.5 still using libmqm, my application was referring to local queue manager and not client manager.
Till date, my application was referring to libmqm library. And my application has many programs which should run on local queue managers so this is fine.
Now only one program in my application has to refer libmqic library while compiling. So i am compiling my application twice once for all and once only for this particular program to point to libmqic and then edploying all at once.
It is working now.
May be i need to check now while compiling how to make sure only this file links to libmqic and all other files links to libmqm until the whole application migrates to use CCDT.

I think you're missing the point I've been trying to make. If you have an application that is already linked with libmqm, you can simply use the MQ_CONNECT_TYPE environment variable and it will act like it was linked with libmqic. You don't need to have two versions of the application, one linked with libmqm and one linked with libmqic anymore.

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Thu Jun 22, 2017 5:15 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20695
Location: LI,NY

hughson wrote:
I think you're missing the point I've been trying to make. If you have an application that is already linked with libmqm, you can simply use the MQ_CONNECT_TYPE environment variable and it will act like it was linked with libmqic. You don't need to have two versions of the application, one linked with libmqm and one linked with libmqic anymore.

Cheers
Morag

Does the client install provide you with libmqm? If you only have libmqic on the client install, it might be better for the op to link to the client library so that he does not get a missing library when running the host with a client install only. Or is the environment variable sufficient to make you skip the entry into libmqm entirely?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
hughson
PostPosted: Thu Jun 22, 2017 1:00 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

fjb_saper wrote:
hughson wrote:
I think you're missing the point I've been trying to make. If you have an application that is already linked with libmqm, you can simply use the MQ_CONNECT_TYPE environment variable and it will act like it was linked with libmqic. You don't need to have two versions of the application, one linked with libmqm and one linked with libmqic anymore.

Cheers
Morag

Does the client install provide you with libmqm? If you only have libmqic on the client install, it might be better for the op to link to the client library so that he does not get a missing library when running the host with a client install only. Or is the environment variable sufficient to make you skip the entry into libmqm entirely?

Whatever you are linked with must exist.

He already links with libmqm for most of his application.

Agree if his environment only has libmqic he must link with libmqic.

MQ_CONNECT_TYPE environment variable does not change the linkage you are linked with, it just changes the behaviour of the libmqm library. It still has to exist if you are linked with it.

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
aravindks3
PostPosted: Thu Jun 22, 2017 10:44 pm    Post subject: Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

The problem is i cannot make my whole application link to libmqic to connect to client. Because few programs in my application rely on the local queue managers running to access the queues.
So i am compiling the required programs with libmqic once and all other programs with libmqm.
if i export MQ_CONNECT_TYPE then whoile application tries to connect as client and it may not be able to fetch the queues under local queue managers(correct me if i am wrong).

hughson wrote:
fjb_saper wrote:
hughson wrote:
I think you're missing the point I've been trying to make. If you have an application that is already linked with libmqm, you can simply use the MQ_CONNECT_TYPE environment variable and it will act like it was linked with libmqic. You don't need to have two versions of the application, one linked with libmqm and one linked with libmqic anymore.

Cheers
Morag

Does the client install provide you with libmqm? If you only have libmqic on the client install, it might be better for the op to link to the client library so that he does not get a missing library when running the host with a client install only. Or is the environment variable sufficient to make you skip the entry into libmqm entirely?

Whatever you are linked with must exist.

He already links with libmqm for most of his application.

Agree if his environment only has libmqic he must link with libmqic.

MQ_CONNECT_TYPE environment variable does not change the linkage you are linked with, it just changes the behaviour of the libmqm library. It still has to exist if you are linked with it.

Cheers
Morag
Back to top
View user's profile Send private message
hughson
PostPosted: Fri Jun 23, 2017 2:04 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

aravindks3 wrote:
The problem is i cannot make my whole application link to libmqic to connect to client. Because few programs in my application rely on the local queue managers running to access the queues.
So i am compiling the required programs with libmqic once and all other programs with libmqm.
if i export MQ_CONNECT_TYPE then whoile application tries to connect as client and it may not be able to fetch the queues under local queue managers(correct me if i am wrong).


I don't know how you run your application to be able to comment on whether you can export an environment variable so that only the piece of the application which needs it will use it.

Your other option you have to change from local bindings to client bindings is to use the MQCNO_CLIENT_BINDING option on the MQCONNX. If you are truly making TWO VERSIONS of an otherwise identical application, so that sometimes it can run as a client and sometimes it can run as local bindings, you could instead make a code change so that your application can be parameterised to make this choice. This may be more work for you than re-linking depending on how well you know the code of the application, but may also save you grief in the future to avoid having to maintain two versions.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
aravindks3
PostPosted: Thu Jul 06, 2017 6:17 pm    Post subject: Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

As we are moving slowly all our interfaces connect through CCDT file, currently only one interface is getting moved. So i compiled my program separately. I am managing that.

But is there any way we can know the status of the Queue or Client Queue manager. Because when i use dspmq, it shows only the local queue manager status and not client queue manager.

I Also used ./amqscnxc -x ConnName -c SvrconnChannelName QMgrName
. It is working. But instead of testing the queue and its status by ./amqsputc or ./amqsgetc is there any other way to display queue status and other details.

hughson wrote:
aravindks3 wrote:
The problem is i cannot make my whole application link to libmqic to connect to client. Because few programs in my application rely on the local queue managers running to access the queues.
So i am compiling the required programs with libmqic once and all other programs with libmqm.
if i export MQ_CONNECT_TYPE then whoile application tries to connect as client and it may not be able to fetch the queues under local queue managers(correct me if i am wrong).


I don't know how you run your application to be able to comment on whether you can export an environment variable so that only the piece of the application which needs it will use it.

Your other option you have to change from local bindings to client bindings is to use the MQCNO_CLIENT_BINDING option on the MQCONNX. If you are truly making TWO VERSIONS of an otherwise identical application, so that sometimes it can run as a client and sometimes it can run as local bindings, you could instead make a code change so that your application can be parameterised to make this choice. This may be more work for you than re-linking depending on how well you know the code of the application, but may also save you grief in the future to avoid having to maintain two versions.

Cheers,
Morag
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jul 07, 2017 3:42 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

What do you mean "client queue manager" ?

An application is only ever connected to one queue manager (per connection, if you're not using bindings and doing things correctly).

So the only queue manager that an application can know about is the one it is connected to.

You should in general not write an MQ application to find out if the queue manager is available before you do anything with it, or otherwise check the qmgr status.

The connection will fail if the queue manager is unavailable. Use that error instead.

If you otherwise want to just monitor a queue manager separately from your application, you can do a number of things - including event messages, PCF messages, MQSC commands, amqscnx(c), ps, etc. etc. etc...

Depends on what you want to monitor. There's a whole section in the Knowledge Center about monitoring.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
aravindks3
PostPosted: Sun Jul 09, 2017 7:51 pm    Post subject: Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

Hi,
I am referring to the Queue manager running on a different machine.
These days we were using the queue manager which was running locally for our application to get connected.
Now we are using CCDT file for connectivity which connects to a queue manager on different server. I am doing it successfully through my application and i get error when the Queue manager is down or anything else.
I just wanted to know from AIX terminal how to check the queue depth, Queue manager status, etc through commands instead of checking my application log which shows the error if the queue manager not running.
I have tried ./amqscnxc -x ConnName -c SvrconnChannelName QMgrName and i can say the connection successfull but if i want to check queue depth etc like runmqsc and commands inside that from my client machine what is the approach.
Because the Queue manager is on different server and from the client machine i want to check the status of the queue manager like runmqsc

mqjeff wrote:
What do you mean "client queue manager" ?

An application is only ever connected to one queue manager (per connection, if you're not using bindings and doing things correctly).

So the only queue manager that an application can know about is the one it is connected to.

You should in general not write an MQ application to find out if the queue manager is available before you do anything with it, or otherwise check the qmgr status.

The connection will fail if the queue manager is unavailable. Use that error instead.

If you otherwise want to just monitor a queue manager separately from your application, you can do a number of things - including event messages, PCF messages, MQSC commands, amqscnx(c), ps, etc. etc. etc...

Depends on what you want to monitor. There's a whole section in the Knowledge Center about monitoring.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Jul 09, 2017 8:37 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20695
Location: LI,NY

Look at the latest versions of runmqsc (v8, v9) and there is a way to do a client connection...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » IBM MQ Installation/Configuration Support » MQ Client Connection using C Programming
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.