wait-consumer


   

SYNOPSIS


    Blocks the current PowerShell session until a message is received from
    the specified consumer.
   

SYNTAX


    wait-consumer [-name] <String> [[-timeout] <String>] [<CommonParameters>]
   
   

DESCRIPTION


    The wait-consumer cmdlet suspends execution until the consumer supplies a
    message from the RabbitMQ server.  When the event is received execution
    continues.  To cancel the wait, press CTRL+C.
   
    Use this cmdlet as an alternative to polling for messages with
    receive-consumer.

PARAMETERS


    -name <String>
        The name of the consumer on which to wait.
       
        Required?                    true
        Position?                    1
        Default value               
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters? 
       
    -timeout <String>
        The number of seconds to wait for an event from the consumer.
        Specify -1 to wait indefinitely.
       
        Required?                    false
        Position?                    2
        Default value               
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters? 
       
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        "get-help about_commonparameters".
   

INPUTS


    The consumer instance on which to wait.  Note that you may only pipe a single
    consumer instance to wait-consumer.
   
   

OUTPUTS


    RabbitMQ.Client.Events.BasicDeliverEventArgs. The message received from
    the consumer, or $null if the specified timeout elapses before a
    message is available.
   
   

NOTES


   
   
        Messages and BasicAck
        ---------------------
        Messages are available during the current PowerShell session and
        are discarded one the session ends.  Because the queues created
        by start-consumer use auto-acknowledge, messages are considered
        acknowledged once the consumer dequeues them.  Any message dequeued
        by the consumer that is not retrieved using wait-consumer or
        receive-consumer will not be requeued in the RabbitMQ server.
   
    -------------------------- EXAMPLE 1 --------------------------
   
    C:\PS>$q = start-consumer -hostname RbtSvr -exchange ps -routingkey 't.?'
    C:\PS> $event = $q | wait-consumer;
   
   
    Description
    -----------
    This example shows how to block execution until a message is supplied
    by a consumer.  When wait-consumer returns, $event will contain the event
    information received from the RabbitMQ server.
   
   
   
   
   
    -------------------------- EXAMPLE 2 --------------------------
   
    C:\PS>$q = start-consumer -hostname RbtSvr -exchange ps -routingkey 't.?'
    C:\PS> $event = $q | wait-consumer -timeout 15;
   
   
    Description
    -----------
    This example shows how to wait for an event using the optional timeout.  If
    no event is available within the 15 second timeout, $event will contain $null.
   
   
   
   
   
   

RELATED LINKS


    RabbitMQ general documentation: http://www.rabbitmq.com/documentation.html
    BasicDeliverEventArgs: http://bit.ly/aQq4yw
    receive-consumer
    start-consumer
    stop-consumer

Last edited Nov 22, 2010 at 2:21 AM by beefarino, version 2

Comments

No comments yet.