[mqm@node01 queue]$ cat t1.pl
use MQSeries qw(:functions);
use MQSeries::QueueManager;
use MQSeries::Queue;
use MQSeries::Message;
#
# Open a queue for input, loop getting messages, updating some
# database with the data.
#
my $qmgr_obj = MQSeries::QueueManager->
new(QueueManager => 'YWJZZF_CZCB_SEND');
my $queue = MQSeries::Queue->
new(QueueManager => $qmgr_obj,
Queue => 'CZ_RSP',
Mode => 'input_exclusive',
) or die("Unable to open queue.
");
my $getmessage = MQSeries::Message->new();
$queue->
Get(Message => $getmessage,
Sync => 1,
) or die("Unable to get message
" .
"CompCode = " . $queue->CompCode() . "
" .
"Reason = " . $queue->Reason() . "
");
print "第一条消息:===";
print $getmessage->Data();
print "
";
# $qmgr_obj->Commit();
读一条消息 队列深度不变;
[mqm@node01 queue]$ perl t1.pl
第一条消息:===147258369