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 API Support » Using Perl MQseries 1.23 to put a message on a remote queue

Post new topic  Reply to topic
 Using Perl MQseries 1.23 to put a message on a remote queue « View previous topic :: View next topic » 
Author Message
nbh
PostPosted: Sat Jul 23, 2005 1:02 am    Post subject: Using Perl MQseries 1.23 to put a message on a remote queue Reply with quote

Newbie

Joined: 23 Jul 2005
Posts: 2

I am under the impression that I do not need a "MQ client" but that I can use Perl to put a message on a MQ queue.

I've looked at getput.pl in the repository and at http://www.itrus.net/Downloads/mqm/samples/perl/mqput was a great sample program. Also from this forum there are a couple of vb and perl example that sort of helped.

From this site http://www.mqfaq.com/webspheremq.php I reassured myself that the server network information HAS to go somewhere.

From cpan http://search.cpan.org/~hbiersma/MQSeries-1.23/MQSeries/Command.pm#Channel_Commands
I sort of see the channel and transport type macros.

Is there a complete example of using Perl to put a message onto a remote queue?

Thanks.

P.S. This was dropped on me late Friday and my Plan B is use Perl and write directly to the SQL database, BUT, my Websphere MQ guys INSIST that MQ is the way to go.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Sat Jul 23, 2005 3:39 am    Post subject: Re: Using Perl MQseries 1.23 to put a message on a remote qu Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

nbh wrote:
I am under the impression that I do not need a "MQ client" but that I can use Perl to put a message on a MQ queue.


This is not true. The MQ API for Perl require an MQClient to be installed on the machine, as they make an XS binding to the native libs.

This means that, not only do you need an MQ Client, you have to have a C compiler somewhere for the same platform, that you can use to build the module.

The perldoc for these modules is very good, and does contain a complete example - albeit spread out over a couple of different modules.

Basically, the perl API provides you two choices. One, the straight C API turned into perl functions. The other is the OO interface - and I would highly recommend this instead if you are not an MQ programmer.

For the OO interface, the connection information is passed to the constructor for the QueueManager object, as named hash values.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Nathan
PostPosted: Mon Jun 05, 2006 6:38 am    Post subject: Reply with quote

Acolyte

Joined: 15 Sep 2003
Posts: 52
Location: Rochester, NY

I know this topic is a bit old... But, I have the same question.

I have MQServer and Client installed and need to have a perl script use the Client to connect to another system's QManager so that I can check the status of Queues and Channels. Does anyone have a Client Connection sample code?

I keep getting 2058.

Thanks,
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jun 05, 2006 6:42 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Change the top line of your program where it says "Use MQSeries;" to "Use MQClient::MQSeries".

http://search.cpan.org/~hbiersma/MQSeries-1.23/MQSeries.pm#Server_vs._Client_API
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Nathan
PostPosted: Mon Jun 05, 2006 6:52 am    Post subject: Reply with quote

Acolyte

Joined: 15 Sep 2003
Posts: 52
Location: Rochester, NY

Did that. If I use the MQCONNX call or the MQSeries::QueueManager->new Object Oriented call, I get the same result. I have successfully used it against a local QManager by removing the client specific calls.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jun 05, 2006 7:14 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Can I see your QueueManager->new call?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Nathan
PostPosted: Mon Jun 05, 2006 7:20 am    Post subject: Reply with quote

Acolyte

Joined: 15 Sep 2003
Posts: 52
Location: Rochester, NY

Here it is...

$QMGR is set to the QManager name (Client channel is named the same)
$Connection is set to host.name.address(port)

Code:
   use MQSeries ;
   use MQSeries::QueueManager ;


   # Initiate QManager
   $qmgr = MQSeries::QueueManager->new
      (
        QueueManager    => $QMGR,
        ClientConn      => {
                             ChannelName     => $QMGR,
                             TransportType   => 'TCP',
                             ConnectionName  => $Connection
                           },
        AutoConnect     => 0,
        ConnectTimeout  => 30,
        Carp            => \&ErrorLog,
      ) || die "Unable to instantiate MQSeries::QueueManager object\n";

   # Connect to QManager
   $qmgr->Connect() ;
   $reason = MQReasonToText($qmgr->Reason()) ;

   print "  Reason: " . $reason . "\n" ;
   print "  Reason: " . $qmgr->Reason() . "\n" ;

   # Disconnect QManager
   $qmgr->Disconnect() ;
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jun 05, 2006 7:22 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I think if you specify the QueueManager it always tries to use the server connection.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Nathan
PostPosted: Mon Jun 05, 2006 7:28 am    Post subject: Reply with quote

Acolyte

Joined: 15 Sep 2003
Posts: 52
Location: Rochester, NY

If I delete the QManager setting, I get the same error.

Here is the MQCONNX call where I get the same 2058 error.
Code:
  use MQClient::MQSeries ;

  $coption = {
               ChannelName     => $QMGR,
               TransportType   => 'TCP',
               ConnectionName  => $Connection
             };
  $Hconn = MQCONNX($QMGR, { 'ClientConn' => $coption,
                          }, $cc, $Reason);

  print "  Reason: " . MQReasonToText($Reason) . "\n" ;
  print "  Reason: $Reason\n" ;

  MQDISC($Hconn,$CompCode,$Reason);


This is pulled right from the MQSeries.pm
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jun 05, 2006 7:39 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

When you built the module, did it build clean?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Nathan
PostPosted: Mon Jun 05, 2006 8:17 am    Post subject: Reply with quote

Acolyte

Joined: 15 Sep 2003
Posts: 52
Location: Rochester, NY

Thanks. I think I figured it out. I knew my code was right. I went and looked at what was compiled (I didn't work here when it was compiled). It is still version 1.17! I will attempt to get it up to 1.23 first.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jun 05, 2006 8:21 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Ah, yeah. That's a big thing.

BEFORE YOU BUILD 1.23! Make sure that you have set up an MQSERVER environment variable in your shell that will run the commands.

This will ensure that all the tests for the MQClient pass, and it will be easier to build and install the module.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Jun 16, 2011 3:26 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

jefflowrey wrote:
Change the top line of your program where it says "Use MQSeries;" to "Use MQClient::MQSeries".

http://search.cpan.org/~hbiersma/MQSeries-1.23/MQSeries.pm#Server_vs._Client_API


Ahha - That's what I need to know ....! Thanks Jeff

Finally got a Perl/MQ program to work. A bit like having to build your own airplane from a kit (some brave/foolish people do this..)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Using Perl MQseries 1.23 to put a message on a remote queue
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.