Re: opening multiple connections from C program on solaris

2003-05-29 Thread Tim Armstrong
Try using MQCONNX and link your program with the client libraries. Example
MQCONNX related code follows.

MQCNO   connectOpts = {MQCNO_DEFAULT};
MQCDclientDef   = {MQCD_CLIENT_CONN_DEFAULT};

strncpy(clientDef.ConnectionName, connNameStr, MQ_CONN_NAME_LENGTH);
strncpy(clientDef.ChannelName, channelNameStr, MQ_CHANNEL_NAME_LENGTH);

connectOpts.ClientConnPtr = &clientDef;
connectOpts.Version = MQCNO_VERSION_2;

MQCONNX(qMgrNameStr,&connectOpts,&hConn,&compCode,&reasonCode);

Good luck.
Tim A



  "Lakshmi, Saraswathi"
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
  SCLEAR.COM>   cc:
  Sent by: MQSeries ListSubject:  opening multiple 
connections from C program on solaris
  <[EMAIL PROTECTED]
  AT>


  28/05/2003 18:15
  Please respond to
  MQSeries List





Hi,

Is it possible to set-up multiple MQ connections from a program in Solaris
env. I tired to set-up multiple connections, but the connection handle is
the same for all of them. Is it possible to get unique connection-handles
for each connection.

The reason for this requirement is that the program has to handle multiple
queues, and the application has to issue MQCMIT based on the data received
in the queues. The program is designed for a real-time asynchronous
communication. The application is up-running all the time  and keeps
polling it other interfaces to check if data has arrived. Based n the data
received from other interfaces, it has to PUT the message into an MQ Queue
and commit it. It is also a single -threaded application.


mfg
lakshmi










The content of this e-mail is intended only for the confidential use of the
person addressed. If you have received this message in error, please notify
us immediately by electronic mail, by telephone or by fax at the above num-
bers.

E-mail communications are not secure and therefore we do not accept any
res-
ponsibility for the confidentiality or altered contents of this message.

Please be aware that SIS Group and its subsidiary companies cannot accept
any orders or other legally binding correspondence with a participant as
part of an E-mail. The views expressed above are not necessarily those held
by SIS Group and its subsidiary companies and not binding for them.
exfe


Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive


Re: opening multiple connections from C program on solaris

2003-05-29 Thread Lakshmi, Saraswathi
Hi, 

THanks for your response. 

We are using MQ 5.2 on all our dev/test/production platforms. We can migrate to MQ 5.3 
only when it has tested in our DEV. env. I have two choices now either to upgrade to 
MQ 5.3 or to make application multi/threaded. We are unable to install MQ 5.3 since 
our dev. is still under Solris 2.6 (for dependencies from other s/w residing on the 
server). 

Right now except for the MQ part - all other events in the program are driven by a 
Semaphore. For the MQ part - polling on MQGET is done. Looks like i have to do some 
re-design with mutli-threading, under the given circumstances.

thanks and regards
lakshmi
> -Original Message-
> From: Paul Clarke [SMTP:[EMAIL PROTECTED]
> Sent: Wednesday, May 28, 2003 1:47 PM
> To:   [EMAIL PROTECTED]
> Subject:       Re: opening multiple connections from C program on solaris
> 
> >Hi,
> 
> >The reason for requiring multiple connections - is the application is
> designed as a gateway to two other applicatins. Hence there >is a
> possiblity of getting messages from either interfaces asynchronously.
> further the async. processing is based on a dialog. >Unless the dialog is
> complete, messages that are retreived or put cannot be commited. If there
> is an error in completing the >dialog, then it should be rolled-back for
> the particular message in question, rather than for all messges that have
> been handled >on that connection (within a given time-interval), but the
> status of other messages in other queues would be different ( because >the
> dialog may not be complete ..because the application is waiting for a
> response to arrive, while it is currently someother >message on a different
> queue). Then we have a problem of data consistency.
> 
> >rgds
> >lakshmi
> 
> lakshmi,
> 
> I think I understand now, you have a dialog which retrieves a message from
> the server under a transaction, this drives a dialog and when the dialog is
> complete you want to send a response and commit the whole as a transaction.
> This seems reasonable, however, if you are acting on behalf of multiple
> dialogs and messages can arrive on the server at any time then I would have
> throught you'd have to do this as a multithreaded application anyway. You
> can't, sadly, wait on an MQGET and on, say, a semaphore at the same time.
> Is there any particular reason why you want to restrict yourself to a
> single thread ?
> 
> Cheers,
> P.
> 
> Paul G Clarke
> WebSphere MQ Development
> IBM Hursley
> 
> Instructions for managing your mailing list subscription are provided in
> the Listserv General Users Guide available at http://www.lsoft.com
> Archive: http://vm.akh-wien.ac.at/MQSeries.archive



The content of this e-mail is intended only for the confidential use of the
person addressed. If you have received this message in error, please notify
us immediately by electronic mail, by telephone or by fax at the above num-
bers.

E-mail communications are not secure and therefore we do not accept any res-
ponsibility for the confidentiality or altered contents of this message.

Please be aware that SIS Group and its subsidiary companies cannot accept
any orders or other legally binding correspondence with a participant as
part of an E-mail. The views expressed above are not necessarily those held
by SIS Group and its subsidiary companies and not binding for them.
exfe

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive


Re: opening multiple connections from C program on solaris

2003-05-29 Thread Paul Clarke
>Hi,

>The reason for requiring multiple connections - is the application is
designed as a gateway to two other applicatins. Hence there >is a
possiblity of getting messages from either interfaces asynchronously.
further the async. processing is based on a dialog. >Unless the dialog is
complete, messages that are retreived or put cannot be commited. If there
is an error in completing the >dialog, then it should be rolled-back for
the particular message in question, rather than for all messges that have
been handled >on that connection (within a given time-interval), but the
status of other messages in other queues would be different ( because >the
dialog may not be complete ..because the application is waiting for a
response to arrive, while it is currently someother >message on a different
queue). Then we have a problem of data consistency.

>rgds
>lakshmi

lakshmi,

I think I understand now, you have a dialog which retrieves a message from
the server under a transaction, this drives a dialog and when the dialog is
complete you want to send a response and commit the whole as a transaction.
This seems reasonable, however, if you are acting on behalf of multiple
dialogs and messages can arrive on the server at any time then I would have
throught you'd have to do this as a multithreaded application anyway. You
can't, sadly, wait on an MQGET and on, say, a semaphore at the same time.
Is there any particular reason why you want to restrict yourself to a
single thread ?

Cheers,
P.

Paul G Clarke
WebSphere MQ Development
IBM Hursley

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive


Re: opening multiple connections from C program on solaris

2003-05-28 Thread Lakshmi, Saraswathi
Hi, 

The reason for requiring multiple connections - is the application is designed as a 
gateway to two other applicatins. Hence there is a possiblity of getting messages from 
either interfaces asynchronously. further the async. processing is based on a dialog. 
Unless the dialog is complete, messages that are retreived or put cannot be commited. 
If there is an error in completing the dialog, then it should be rolled-back for the 
particular message in question, rather than for all messges that have been handled on 
that connection (within a given time-interval), but the status of other messages in 
other queues would be different ( because the dialog may not be complete ..because the 
application is waiting for a response to arrive, while it is currently someother 
message on a different queue). Then we have a problem of data consistency. 

rgds
lakshmi


> -Original Message-
> From: Paul Clarke [SMTP:[EMAIL PROTECTED]
> Sent: Wednesday, May 28, 2003 11:21 AM
> To:   [EMAIL PROTECTED]
> Subject:       Re: opening multiple connections from C program on solaris
> 
> >Hi,
> 
> >Is it possible to set-up multiple MQ connections from a program in Solaris
> env. I tired to set-up multiple connections, but the >connection handle is
> the same for all of them. Is it possible to get unique connection-handles
> for each connection.
> 
> >The reason for this requirement is that the program has to handle multiple
> queues, and the application has to issue MQCMIT based >on the data received
> in the queues. The program is designed for a real-time asynchronous
> communication. The application is >up-running all the time  and keeps
> polling it other interfaces to check if data has arrived. Based n the data
> received from other >interfaces, it has to PUT the message into an MQ Queue
> and commit it. It is also a single -threaded application.
> 
> 
> >mfg
> >lakshmi
> 
> Prior to 5.3 you could only have one connection to one Queue Manager in
> each thread. Since your application is single threaded then you can only
> have one connection. I would expect you to get back reason code
> MQRC_ALREADY_CONNECTED on your subsequent attempts to connect. In 5.3 you
> can ask for 'shared' connection when you issue MQCONNX. This connection can
> be used across threads and you can issue MQCONN multiple times on the same
> thread.
> 
> What I don't quite understand is why, in a single threaded application that
> seems to be issuing one MQPUT, you need to have multiple connections to the
> Queue Manager anyway.
> 
> Cheers,
> P.
> 
> Paul G Clarke
> WebSphere MQ Development
> IBM Hursley
> 
> Instructions for managing your mailing list subscription are provided in
> the Listserv General Users Guide available at http://www.lsoft.com
> Archive: http://vm.akh-wien.ac.at/MQSeries.archive



The content of this e-mail is intended only for the confidential use of the
person addressed. If you have received this message in error, please notify
us immediately by electronic mail, by telephone or by fax at the above num-
bers.

E-mail communications are not secure and therefore we do not accept any res-
ponsibility for the confidentiality or altered contents of this message.

Please be aware that SIS Group and its subsidiary companies cannot accept
any orders or other legally binding correspondence with a participant as
part of an E-mail. The views expressed above are not necessarily those held
by SIS Group and its subsidiary companies and not binding for them.
exfe

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive


Re: opening multiple connections from C program on solaris

2003-05-28 Thread Paul Clarke
>Hi,

>Is it possible to set-up multiple MQ connections from a program in Solaris
env. I tired to set-up multiple connections, but the >connection handle is
the same for all of them. Is it possible to get unique connection-handles
for each connection.

>The reason for this requirement is that the program has to handle multiple
queues, and the application has to issue MQCMIT based >on the data received
in the queues. The program is designed for a real-time asynchronous
communication. The application is >up-running all the time  and keeps
polling it other interfaces to check if data has arrived. Based n the data
received from other >interfaces, it has to PUT the message into an MQ Queue
and commit it. It is also a single -threaded application.


>mfg
>lakshmi

Prior to 5.3 you could only have one connection to one Queue Manager in
each thread. Since your application is single threaded then you can only
have one connection. I would expect you to get back reason code
MQRC_ALREADY_CONNECTED on your subsequent attempts to connect. In 5.3 you
can ask for 'shared' connection when you issue MQCONNX. This connection can
be used across threads and you can issue MQCONN multiple times on the same
thread.

What I don't quite understand is why, in a single threaded application that
seems to be issuing one MQPUT, you need to have multiple connections to the
Queue Manager anyway.

Cheers,
P.

Paul G Clarke
WebSphere MQ Development
IBM Hursley

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive


opening multiple connections from C program on solaris

2003-05-28 Thread Lakshmi, Saraswathi
Hi, 

Is it possible to set-up multiple MQ connections from a program in Solaris env. I 
tired to set-up multiple connections, but the connection handle is the same for all of 
them. Is it possible to get unique connection-handles for each connection. 

The reason for this requirement is that the program has to handle multiple queues, and 
the application has to issue MQCMIT based on the data received in the queues. The 
program is designed for a real-time asynchronous communication. The application is 
up-running all the time  and keeps polling it other interfaces to check if data has 
arrived. Based n the data received from other interfaces, it has to PUT the message 
into an MQ Queue and commit it. It is also a single -threaded application. 


mfg
lakshmi









The content of this e-mail is intended only for the confidential use of the
person addressed. If you have received this message in error, please notify
us immediately by electronic mail, by telephone or by fax at the above num-
bers.

E-mail communications are not secure and therefore we do not accept any res-
ponsibility for the confidentiality or altered contents of this message.

Please be aware that SIS Group and its subsidiary companies cannot accept
any orders or other legally binding correspondence with a participant as
part of an E-mail. The views expressed above are not necessarily those held
by SIS Group and its subsidiary companies and not binding for them.
exfe

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive