use strict;
use Win32::OLE;
getInbox('MSMQ-Server\private$\Test');
sub getInbox()
{
my $Queue = shift;
my $message;
my $getInboxMsg = Win32::OLE->new('MSMQ.MSMQMessage');
my $getInboxInfo = Win32::OLE->new('MSMQ.MSMQQueueInfo');
$getInboxInfo->{FormatName}= "direct=os:" . $Queue;
my $getInboxQue= $getInboxInfo->Open(1,0) or return $_;
if (defined($getInboxQue))
{
$message = $getInboxQue->Receive();
$getInboxQue->Close;
}
return $message->{Body};;
}
Custom Search
|
PayPal is the easiest way to receive money online. Get one now or Click here to sign up.
How to receive message in MSMQ using perl
How to send message in non-transactional MSMQ queue using perl
&sendInbox("Body",'MSMQ-server\private$\Test');
sub sendInbox()
{
my $Body = shift;
my $Queue = shift;
my $sendMsg = Win32::OLE->new('MSMQ.MSMQMessage');
my $sendInfo = Win32::OLE->new('MSMQ.MSMQQueueInfo');
$sendInfo->{FormatName}= "direct=os:" . $Queue;
my $sendQ = $sendInfo->Open(2, 0);
$sendMsg->{Label}= "Label";
$sendMsg->{Body}= $Body;
#Send Message
$sendMsg->Send($sendQ);
$sendQ->Close;
}
Labels:
Message,
MSMQ,
non-transactional,
Perl,
Queuing
Subscribe to:
Posts (Atom)
WebProNews Feed
Custom Search
|
eWeek - RSS Feeds
HowtoForge - Howtos and Tutorials
The Register
PayPal is the easiest way to receive money online. Get one now or Click here to sign up.