This topic has not yet been rated - Rate this topic

QueueClient Class

Represents the queue client object.

System.Object
  Microsoft.ServiceBus.Messaging.MessageClientEntity
    Microsoft.ServiceBus.Messaging.QueueClient

Namespace:  Microsoft.ServiceBus.Messaging
Assembly:  Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)
public abstract class QueueClient : MessageClientEntity

The QueueClient type exposes the following members.

  Name Description
Protected property InternalReceiver Gets or sets the message receiver for the queue.
Protected property InternalSender Gets or sets the message sender for the queue.
Public property IsClosed Gets or sets a value that indicates whether the message client entity is closed. (Inherited from MessageClientEntity.)
Protected property IsSubQueue Gets or sets a value that indicates whether the message receiver is created from a subqueue.
Public property MessagingFactory Gets or sets the messaging factory.
Public property Mode Gets the message receive mode when processing the received message.
Public property Path Gets or sets the full path name of the queue.
Public property PrefetchCount Gets or sets the number of messages that the queue receiver can simultaneously request.
Top
  Name Description
Public method Abandon Discards the message and relinquishes the message lock ownership.
Public method Abort Aborts the message client entity and puts its status into a closing state. (Inherited from MessageClientEntity.)
Public method AcceptMessageSession() Accepts a message session that allows grouping of related messages for processing in a single transaction.
Public method AcceptMessageSession(String) Accepts a message session that allows grouping of related messages for processing in a single transaction using the given session identifier.
Public method AcceptMessageSession(TimeSpan) Accepts a message session that allows grouping of related messages for processing in a single transaction using the specified server wait time.
Public method AcceptMessageSession(String, TimeSpan) Accepts a message session that allows grouping of related messages for processing in a single transaction using the given session identifier and wait time.
Public method BeginAbandon Begins an asynchronous operation to abandon the message and relinquish its lock.
Public method BeginAcceptMessageSession(AsyncCallback, Object) Begin an asynchronous operation to accept a message session.
Public method BeginAcceptMessageSession(String, AsyncCallback, Object) Begin an asynchronous operation to accept a message session.
Public method BeginAcceptMessageSession(TimeSpan, AsyncCallback, Object) Begin an asynchronous operation to accept a message session.
Public method BeginAcceptMessageSession(String, TimeSpan, AsyncCallback, Object) Begin an asynchronous operation to accept a message session.
Public method BeginClose Begins an asynchronous operation to close the message client entity. (Inherited from MessageClientEntity.)
Public method BeginComplete Begins an asynchronous operation to complete processing of a message.
Public method BeginDeadLetter(Guid, AsyncCallback, Object) Begins an asynchronous operation to move a message to the dead letter queue.
Public method BeginDeadLetter(Guid, String, String, AsyncCallback, Object) Begins an asynchronous operation to move a message to the dead letter queue.
Public method BeginDefer Begins an asynchronous operation to suspend processing of a message.
Public method BeginReceive(AsyncCallback, Object) Begins an asynchronous operation to receive a message.
Public method BeginReceive(Int64, AsyncCallback, Object) Begins an asynchronous operation to receive a message.
Public method BeginReceive(TimeSpan, AsyncCallback, Object) Begins an asynchronous operation to receive a message.
Public method BeginSend Begins an asynchronous operation to send a message.
Public method Close Closes the message client entity and puts its status into a closed state. (Inherited from MessageClientEntity.)
Public method Complete Completes processing of a message.
Public method DeadLetter(Guid) Moves the undelivered message to the dead letter queue.
Public method DeadLetter(Guid, String, String) Moves the undelivered message to the dead letter queue.
Public method Defer Suspends the processing of a message.
Public method EndAbandon Finishes an asynchronous operation to abandon the message and relinquish its lock.
Public method EndAcceptMessageSession Finishes an asynchronous operation to accept a message session that allows grouping of related messages for processing in a single transaction.
Public method EndClose Finishes an asynchronous operation to close the message client entity. (Inherited from MessageClientEntity.)
Public method EndComplete Finishes an asynchronous operation to complete processing of a message.
Public method EndDeadLetter Finishes an asynchronous operation to move message to the dead letter queue.
Public method EndDefer Finishes an asynchronous operation to suspend processing of a message.
Public method EndReceive Finishes an asynchronous operation to receive a message.
Public method EndSend Finishes an asynchronous operation to send a message.
Public method Equals (Inherited from Object.)
Protected method Fault Puts the message client entity into a faulted state. (Inherited from MessageClientEntity.)
Protected method Finalize (Inherited from Object.)
Public method Static member FormatDeadLetterPath Builds a format name from the specified dead letter queue path.
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Protected method OnAbort Executes upon calling the Abort event. (Overrides MessageClientEntity.OnAbort().)
Protected method OnBeginAcceptMessageSession Executes upon calling the BeginAcceptMessageSession operation.
Protected method OnBeginClose Executes when the Close operation is called. (Overrides MessageClientEntity.OnBeginClose(TimeSpan, AsyncCallback, Object).)
Protected method OnBeginCreateReceiver(ReceiveMode, TimeSpan, AsyncCallback, Object) Executes the begin create receiver action.
Protected method OnBeginCreateReceiver(String, ReceiveMode, TimeSpan, AsyncCallback, Object) Executes the begin create receiver action.
Protected method OnBeginCreateSender Executes the begin create sender action.
Protected method OnBeginOpen Executes upon calling the operation to begin to open the message client entity. (Inherited from MessageClientEntity.)
Protected method OnClose Executes upon calling the Close action. (Overrides MessageClientEntity.OnClose(TimeSpan).)
Protected method OnClosed Occurs when the message client entity is transitioned into a closing state. (Inherited from MessageClientEntity.)
Protected method OnEndAcceptMessageSession Executes upon calling the EndAcceptMessageSession operation.
Protected method OnEndClose Executes the end close action. (Overrides MessageClientEntity.OnEndClose(IAsyncResult).)
Protected method OnEndCreateReceiver Executes the end create receiver action.
Protected method OnEndCreateSender Executes the end create sender action.
Protected method OnEndOpen Executes upon calling the operation to end to open the message client entity. (Inherited from MessageClientEntity.)
Protected method OnFaulted Executes upon calling the Fault operation. (Inherited from MessageClientEntity.)
Protected method OnOpen Executes upon calling the operation to open the message client entity. (Inherited from MessageClientEntity.)
Protected method OnOpened Executes when the message client entity is opened. (Inherited from MessageClientEntity.)
Public method Receive() Receives a message using the InternalReceiver.
Public method Receive(Int64) Receives a message using the InternalReceiver.
Public method Receive(TimeSpan) Receives a message using the InternalReceiver.
Public method Send Sends a message using the InternalSender.
Protected method ThrowIfClosed Throws an exception if the message client entity is closed. (Inherited from MessageClientEntity.)
Protected method ThrowIfDisposed Throws an exception if the message client entity is disposed. (Inherited from MessageClientEntity.)
Protected method ThrowIfDisposedOrImmutable Throws an exception if the client is disposed or immutable. (Inherited from MessageClientEntity.)
Protected method ThrowIfDisposedOrNotOpen Throws an exception if the client is disposed or not open. (Inherited from MessageClientEntity.)
Protected method ThrowIfFaulted Throws an exception if the client is faulted. (Inherited from MessageClientEntity.)
Public method ToString (Inherited from Object.)
Top

This class is mainly used for service bus run-time operations, such as sending and receiving messages.

This abstract class is not meant to be inherited, so protected members of this class should be ignored.

// Create the MessagingFactory
     MessagingFactory factory = 
     MessagingFactory.Create(myServiceBusNamespaceUri, SharedSecretTokenProvider.CreateSharedSecretTokenProvider(issuerName, issuerKey));
    
     //********************************************************************************
     //                          Sending messages to a Queue
     //********************************************************************************
    
     // Create queue client
     QueueClient myQueueClient = factory.CreateQueueClient("myQueue");
    
     // Send messages
     List <object> Issues = new List <object>();
     foreach (var issue in Issues)
     {
        myQueueClient.Send(new BrokeredMessage(issue));
     }
    
     // ... Recieve messages
     for (int count = 0; count < MsgCount; count++)
     {
         var message = myQueueClient.Receive();
         message.Complete();
     }

Any public static (Shared in Visual Basic) members of this type are thread safe. Instance members are also guaranteed to be thread safe.

Did you find this helpful?
(1500 characters remaining)