note 82465 added to class.com
| From: | joaopauloln7 at gmail dot com | Date: | Fri, 11 Apr 2008 20:59:34 +0000 |
| Subject: | note 82465 added to class.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138195@lists.php.net to get a copy of this message | ||
Sample collection of messages service queue of Windows.
(Exemplo de Recebimento das mensagens do serviço de fila do Windows)
Developed by : João Paulo Leite Nascimento, Hangel Rodrigues.
Email: joaopauloln7@gmail.com , hangedicastro@gmail.com;
<?php
try{
// define constantes (define constants)
define(MQ_RECEIVE_MESSAGE , 1);
define(MQ_DENY_NONE , 0);
// Instancia o objeto COM (Place the object COM)
$msgQueue = new COM("MSMQ.MSMQQueue") or die("can not create MSMQ
object");
$msgQueueInfo = new COM("MSMQ.MSMQQueueInfo") or die("can not create MSMQ
Info object");
$MSMQQueueMsg = new COM("MSMQ.MSMQMessage") or die("can not create MSMQ
message object");
// define o nome do caminho onde se encontra a fila (Defines the name of the road where the
queue)
$msgQueueInfo->FormatName = "path name";
// abre a fila (Open the queue)
$rcv = $msgQueueInfo->Open(MQ_RECEIVE_MESSAGE, MQ_DENY_NONE);
// se a fila não for aberta (if the queue not opened)
if (!$rcv->IsOpen) {
die("Falha na abertura da fila");
}
// seta o valor de timeout (set the value of timeout)
$ReceiveTimeout = 100;
// recebe a primeira mensagem da lista (Receive the first message from the list)
$msg = $rcv->PeekCurrent(FALSE, TRUE, $ReceiveTimeout);
do {
if(substr($msg->Body,0,4)!= "ERRO" ){
echo $msg->Label;
echo $msg->Body;
}
// recebe o próximo mensagem da lista (Receive the next message from the list)
$msg = $rcv->PeekNext(FALSE, TRUE, $ReceiveTimeout);
} while ($msg);
// limpa as variáveis (Clean the variables)
unset($msgQueue);
unset($msgQueueInfo);
} catch (Exception $e){
echo $e->getMessage();
echo $e->getLine();
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 200.198.216.103
----
Manual Page -- http://www.php.net/manual/en/class.com.php
Edit -- https://master.php.net/note/edit/82465
Del: integrated -- https://master.php.net/note/delete/82465/integrated
Del: useless -- https://master.php.net/note/delete/82465/useless
Del: bad code -- https://master.php.net/note/delete/82465/bad+code
Del: spam -- https://master.php.net/note/delete/82465/spam
Del: non-english -- https://master.php.net/note/delete/82465/non-english
Del: in docs -- https://master.php.net/note/delete/82465/in+docs
Del: other reasons-- https://master.php.net/note/delete/82465
Reject -- https://master.php.net/note/reject/82465
Search -- https://master.php.net/manage/user-notes.php