Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

QueueClient Class

Represents the queue client object.

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

The QueueClient type exposes the following members.

  NameDescription
Public propertyIsClosedGets or sets a value that indicates whether the message client entity is closed. (Inherited from MessageClientEntity.)
Public propertyMessagingFactoryGets or sets the messaging factory.
Public propertyModeGets the message receive mode when processing the received message.
Public propertyPathGets or sets the full path name of the queue.
Public propertyPrefetchCountGets or sets the number of messages that the queue receiver can simultaneously request.
Public propertyRetryPolicyGets or sets a retry policy associated with this instance that determines whether if the request should be retried. (Inherited from MessageClientEntity.)
Protected propertyThisLockGents an object used for locking the MessageClientEntity instance. (Inherited from MessageClientEntity.)
Top
  NameDescription
Public methodAbandon(Guid)Discards the message and relinquishes the message lock ownership.
Public methodAbandon(Guid, IDictionary<String, Object>)Discards the message and relinquishes the message lock ownership.
Public methodAbandonAsync(Guid)Asynchronously discards the message and relinquishes the message lock ownership.
Public methodAbandonAsync(Guid, IDictionary<String, Object>)Asynchronously discards the message and relinquishes the message lock ownership.
Public methodAbortAborts the message client entity and puts its status into a closing state. (Inherited from MessageClientEntity.)
Public methodAcceptMessageSession()Accepts a message session that allows grouping of related messages for processing in a single transaction.
Public methodAcceptMessageSession(String)Accepts a message session that allows grouping of related messages for processing in a single transaction using the given session identifier.
Public methodAcceptMessageSession(TimeSpan)Accepts a message session that allows grouping of related messages for processing in a single transaction using the specified server wait time.
Public methodAcceptMessageSession(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 methodAcceptMessageSessionAsync()Asynchronously accepts a message session that allows grouping of related messages for processing in a single transaction.
Public methodAcceptMessageSessionAsync(String)Asynchronously accepts a message session that allows grouping of related messages for processing in a single transaction using the given session identifier.
Public methodAcceptMessageSessionAsync(TimeSpan)Asynchronously accepts a message session that allows grouping of related messages for processing in a single transaction using the specified server wait time.
Public methodAcceptMessageSessionAsync(String, TimeSpan)Asynchronously 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 methodBeginAbandon(Guid, AsyncCallback, Object)Begins an asynchronous operation to abandon the message and relinquish its lock.
Public methodBeginAbandon(Guid, IDictionary<String, Object>, AsyncCallback, Object)Begins an asynchronous operation to abandon the message and relinquish its lock.
Public methodBeginAcceptMessageSession(AsyncCallback, Object)Begins an asynchronous operation to accept a message session.
Public methodBeginAcceptMessageSession(String, AsyncCallback, Object)Begins an asynchronous operation to accept a message session.
Public methodBeginAcceptMessageSession(TimeSpan, AsyncCallback, Object)Begins an asynchronous operation to accept a message session.
Public methodBeginAcceptMessageSession(String, TimeSpan, AsyncCallback, Object)Begins an asynchronous operation to accept a message session.
Public methodBeginCloseBegins an asynchronous operation to close the message client entity. (Inherited from MessageClientEntity.)
Public methodBeginCompleteBegins an asynchronous operation to complete processing of a message.
Public methodBeginCompleteBatchBegins an asynchronous operation to complete processing of a message batch.
Public methodBeginDeadLetter(Guid, AsyncCallback, Object)Begins an asynchronous operation to move a message to the dead letter queue.
Public methodBeginDeadLetter(Guid, IDictionary<String, Object>, AsyncCallback, Object)Begins an asynchronous operation to move a message to the dead letter queue.
Public methodBeginDeadLetter(Guid, String, String, AsyncCallback, Object)Begins an asynchronous operation to move a message to the dead letter queue.
Public methodBeginDefer(Guid, AsyncCallback, Object)Begins an asynchronous operation to suspend processing of a message.
Public methodBeginDefer(Guid, IDictionary<String, Object>, AsyncCallback, Object)Begins an asynchronous operation to suspend processing of a message.
Public methodBeginGetMessageSessions(AsyncCallback, Object)Begins an asynchronous operation to get the message sessions.
Public methodBeginGetMessageSessions(DateTime, AsyncCallback, Object)Begins an asynchronous operation to get the message sessions.
Public methodBeginPeek(AsyncCallback, Object)Begins an asynchronous operation to peek a message.
Public methodBeginPeek(Int64, AsyncCallback, Object)Begins an asynchronous operation to peek a message.
Public methodBeginPeekBatch(Int32, AsyncCallback, Object)Begins an asynchronous operation to peek a batch of messages.
Public methodBeginPeekBatch(Int64, Int32, AsyncCallback, Object)Begins an asynchronous operation to peek a batch of messages.
Public methodBeginReceive(AsyncCallback, Object)Begins an asynchronous operation to receive a message.
Public methodBeginReceive(Int64, AsyncCallback, Object)Begins an asynchronous operation to receive a message.
Public methodBeginReceive(TimeSpan, AsyncCallback, Object)Begins an asynchronous operation to receive a message.
Public methodBeginReceiveBatch(IEnumerable<Int64>, AsyncCallback, Object)Begins an asynchronous operation to receive a message batch.
Public methodBeginReceiveBatch(Int32, AsyncCallback, Object)Begins an asynchronous operation to receive a message batch.
Public methodBeginReceiveBatch(Int32, TimeSpan, AsyncCallback, Object)Begins an asynchronous operation to receive a message batch.
Public methodBeginSendBegins an asynchronous operation to send a message.
Public methodBeginSendBatchBegins an asynchronous operation to send a message batch.
Public methodCloseCloses the message client entity and puts its status into a closed state. (Inherited from MessageClientEntity.)
Public methodCloseAsyncAsynchronously closes the message client entity and puts its status into a closed state. (Inherited from MessageClientEntity.)
Public methodCompleteCompletes processing of a message.
Public methodCompleteAsyncAsynchronously completes processing of a message.
Public methodCompleteBatchCompletes processing of a message batch.
Public methodCompleteBatchAsyncAsynchronously completes processing of a message batch.
Public methodStatic memberCreate(String)Creates a new copy of QueueClient with specified path.
Public methodStatic memberCreate(String, ReceiveMode)Creates a new copy of QueueClient with specified path and mode.
Public methodStatic memberCreateFromConnectionString(String, String)Creates a new copy of QueueClient from connection string with specified path.
Public methodStatic memberCreateFromConnectionString(String, String, ReceiveMode)Creates a new copy of QueueClient from connection string with specified path and mode.
Public methodDeadLetter(Guid)Moves the undelivered message to the dead letter queue.
Public methodDeadLetter(Guid, IDictionary<String, Object>)Moves the undelivered message to the dead letter queue.
Public methodDeadLetter(Guid, String, String)Moves the undelivered message to the dead letter queue.
Public methodDeadLetterAsync(Guid)Asynchronously moves the undelivered message to the dead letter queue.
Public methodDeadLetterAsync(Guid, IDictionary<String, Object>)Asynchronously moves the undelivered message to the dead letter queue.
Public methodDeadLetterAsync(Guid, String, String)Asynchronously moves the undelivered message to the dead letter queue.
Public methodDefer(Guid)Suspends the processing of a message.
Public methodDefer(Guid, IDictionary<String, Object>)Suspends the processing of a message.
Public methodDeferAsync(Guid)Asynchronously suspends the processing of a message.
Public methodDeferAsync(Guid, IDictionary<String, Object>)Asynchronously suspends the processing of a message.
Public methodEndAbandonFinishes an asynchronous operation to abandon the message and relinquish its lock.
Public methodEndAcceptMessageSessionFinishes an asynchronous operation to accept a message session that allows grouping of related messages for processing in a single transaction.
Public methodEndCloseFinishes an asynchronous operation to close the message client entity. (Inherited from MessageClientEntity.)
Public methodEndCompleteFinishes an asynchronous operation to complete processing of a message.
Public methodEndCompleteBatchFinishes an asynchronous operation to complete processing of a message batch.
Public methodEndDeadLetterFinishes an asynchronous operation to move message to the dead letter queue.
Public methodEndDeferFinishes an asynchronous operation to suspend processing of a message.
Public methodEndGetMessageSessionsEnds an asynchronous operation to get the message sessions.
Public methodEndPeekEnds an asynchronous operation to peek a message.
Public methodEndPeekBatchEnds an asynchronous operation to peek a batch of messages.
Public methodEndReceiveFinishes an asynchronous operation to receive a message.
Public methodEndReceiveBatchFinishes an asynchronous operation to receive a message batch.
Public methodEndSendFinishes an asynchronous operation to send a message.
Public methodEndSendBatchFinishes an asynchronous operation to send a message batch.
Public methodEquals (Inherited from Object.)
Protected methodFaultPuts the message client entity into a faulted state. (Inherited from MessageClientEntity.)
Protected methodFinalize (Inherited from Object.)
Public methodStatic memberFormatDeadLetterPathBuilds a format name from the specified dead letter queue path.
Public methodGetHashCode (Inherited from Object.)
Public methodGetMessageSessions()Gets the message sessions, enabling you to browse sessions on queues.
Public methodGetMessageSessions(DateTime)Retrieves all message sessions whose session state was updated since lastUpdatedTime.
Public methodGetMessageSessionsAsync()Asynchronously gets the message sessions, enabling you to browse sessions on queues.
Public methodGetMessageSessionsAsync(DateTime)Asynchronously retrieves all message sessions whose session state was updated since lastUpdatedTime.
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodOnAbortExecutes upon calling the Abort event. (Overrides MessageClientEntity::OnAbort().)
Protected methodOnBeginAcceptMessageSessionExecutes upon calling the BeginAcceptMessageSession operation.
Protected methodOnBeginCloseExecutes when the Close operation is called. (Overrides MessageClientEntity::OnBeginClose(TimeSpan, AsyncCallback, Object).)
Protected methodOnBeginCreateReceiver(ReceiveMode, TimeSpan, AsyncCallback, Object)Executes the begin create receiver action.
Protected methodOnBeginCreateReceiver(String, ReceiveMode, TimeSpan, AsyncCallback, Object)Executes the begin create receiver action.
Protected methodOnBeginCreateSenderExecutes the begin create sender action.
Protected methodOnBeginGetMessageSessionsExecutes the BeginGetMessageSessions action.
Protected methodOnBeginOpenExecutes upon calling the operation to begin to open the message client entity. (Inherited from MessageClientEntity.)
Protected methodOnCloseExecutes upon calling the Close action. (Overrides MessageClientEntity::OnClose(TimeSpan).)
Protected methodOnClosedOccurs when the message client entity is transitioned into a closing state. (Inherited from MessageClientEntity.)
Protected methodOnEndAcceptMessageSessionExecutes upon calling the EndAcceptMessageSession operation.
Protected methodOnEndCloseExecutes the end close action. (Overrides MessageClientEntity::OnEndClose(IAsyncResult).)
Protected methodOnEndCreateReceiverExecutes the end create receiver action.
Protected methodOnEndCreateSenderExecutes the end create sender action.
Protected methodOnEndGetMessageSessionsExecutes the end get message action.
Protected methodOnEndOpenExecutes upon calling the operation to end to open the message client entity. (Inherited from MessageClientEntity.)
Protected methodOnFaultedExecutes upon calling the Fault operation. (Inherited from MessageClientEntity.)
Public methodOnMessage(Action<BrokeredMessage>)Processes a message in an event-driven message pump.
Public methodOnMessage(Action<BrokeredMessage>, OnMessageOptions)Processes a message in an event-driven message pump, with the given set of OnMessageOptions options.
Public methodOnMessageAsync(Func<BrokeredMessage, Task>)Asynchronously processes a message.
Public methodOnMessageAsync(Func<BrokeredMessage, Task>, OnMessageOptions)Asynchronously processes a message.
Protected methodOnOpenExecutes upon calling the operation to open the message client entity. (Inherited from MessageClientEntity.)
Protected methodOnOpenedExecutes when the message client entity is opened. (Inherited from MessageClientEntity.)
Public methodPeek()Returns without removing the first message in the queue.
Public methodPeek(Int64)Returns without removing the first message in the queue.
Public methodPeekAsync()Asynchronously returns without removing the first message in the queue.
Public methodPeekAsync(Int64)Asynchronously returns without removing the first message in the queue.
Public methodPeekBatch(Int32)Peeks a batch of message.
Public methodPeekBatch(Int64, Int32)Peeks a batch of messages.
Public methodPeekBatchAsync(Int32)Asynchronously peeks a batch of message.
Public methodPeekBatchAsync(Int64, Int32)Asynchronously peeks a batch of message.
Public methodReceive()Receives a message using the InternalReceiver().
Public methodReceive(Int64)Receives a message using the InternalReceiver().
Public methodReceive(TimeSpan)Receives a message using the InternalReceiver().
Public methodReceiveAsync()Asynchronously receives a message using the InternalReceiver().
Public methodReceiveAsync(Int64)Asynchronously receives a message using the InternalReceiver().
Public methodReceiveAsync(TimeSpan)Asynchronously receives a message using the InternalReceiver().
Public methodReceiveBatch(IEnumerable<Int64>)Receives a message batch.
Public methodReceiveBatch(Int32)Receives a message batch.
Public methodReceiveBatch(Int32, TimeSpan)Receives a message batch.
Public methodReceiveBatchAsync(IEnumerable<Int64>)Asynchronously receives a message batch.
Public methodReceiveBatchAsync(Int32)Asynchronously receives a message batch.
Public methodReceiveBatchAsync(Int32, TimeSpan)Asynchronously receives a message batch.
Public methodRegisterSessionHandler(Type)Registers the session handler with specific type.
Public methodRegisterSessionHandler(Type, SessionHandlerOptions)Registers the session handler with specific type and handler options.
Public methodRegisterSessionHandlerAsync(Type)Asynchronously registers the session handler with specific type.
Public methodRegisterSessionHandlerAsync(Type, SessionHandlerOptions)Asynchronously registers the session handler with specific type and handler options.
Public methodRegisterSessionHandlerFactory(IMessageSessionAsyncHandlerFactory, SessionHandlerOptions)Registers a message session handler factory with specified options.
Public methodRegisterSessionHandlerFactory(IMessageSessionHandlerFactory, SessionHandlerOptions)Registers a message session handler factory with specified options.
Public methodRegisterSessionHandlerFactoryAsync(IMessageSessionAsyncHandlerFactory, SessionHandlerOptions)Asynchronously registers a message session handler factory.
Public methodRegisterSessionHandlerFactoryAsync(IMessageSessionHandlerFactory, SessionHandlerOptions)Asynchronously registers a message session handler factory.
Public methodSendSends a message using the InternalSender().
Public methodSendAsyncAsynchronously sends a message using the InternalSender().
Public methodSendBatchSends a set of brokered messages (for batch processing).
Public methodSendBatchAsyncAsynchronously sends a set of brokered messages (for batch processing).
Protected methodThrowIfClosedThrows an exception if the message client entity is closed. (Inherited from MessageClientEntity.)
Protected methodThrowIfDisposedThrows an exception if the message client entity is disposed. (Inherited from MessageClientEntity.)
Protected methodThrowIfDisposedOrImmutableThrows an exception if the client is disposed or immutable. (Inherited from MessageClientEntity.)
Protected methodThrowIfDisposedOrNotOpenThrows an exception if the client is disposed or not open. (Inherited from MessageClientEntity.)
Protected methodThrowIfFaultedThrows an exception if the client is faulted. (Inherited from MessageClientEntity.)
Public methodToString (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.

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.