IQueueClient Interface
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
QueueClient can be used for all basic interactions with a Service Bus Queue.
public interface IQueueClient : Microsoft.Azure.ServiceBus.Core.IReceiverClient, Microsoft.Azure.ServiceBus.Core.ISenderClient
type IQueueClient = interface
interface IReceiverClient
interface IClientEntity
interface ISenderClient
Public Interface IQueueClient
Implements IReceiverClient, ISenderClient
- Derived
- Implements
Create a new QueueClient
IQueueClient queueClient = new QueueClient(
namespaceConnectionString,
queueName,
ReceiveMode.PeekLock,
RetryExponential);
Send a message to the queue:
byte[] data = GetData();
await queueClient.SendAsync(data);
Register a message handler which will be invoked every time a message is received.
queueClient.RegisterMessageHandler(
async (message, token) =>
{
// Process the message
Console.WriteLine($"Received message: SequenceNumber:{message.SystemProperties.SequenceNumber} Body:{Encoding.UTF8.GetString(message.Body)}");
// Complete the message so that it is not received again.
// This can be done only if the queueClient is opened in ReceiveMode.PeekLock mode.
await queueClient.CompleteAsync(message.SystemProperties.LockToken);
},
async (exceptionEvent) =>
{
// Process the exception
Console.WriteLine("Exception = " + exceptionEvent.Exception);
return Task.CompletedTask;
});
Use IMessageSender or IMessageReceiver for advanced set of functionality.
Client |
Gets the ID to identify this client. This can be used to correlate logs and exceptions. (Inherited from IClientEntity) |
Is |
Returns true if the client is closed or closing. (Inherited from IClientEntity) |
Operation |
Duration after which individual operations will timeout. (Inherited from IClientEntity) |
Owns |
Returns true if connection is owned and false if connection is shared. (Inherited from IClientEntity) |
Path |
Gets the entity path. (Inherited from IClientEntity) |
Prefetch |
Prefetch speeds up the message flow by aiming to have a message readily available for local retrieval when and before the application asks for one using Receive. Setting a non-zero value prefetches PrefetchCount number of messages. Setting the value to zero turns prefetch off. Defaults to 0. (Inherited from IReceiverClient) |
Queue |
Gets the name of the queue. |
Receive |
Gets the ReceiveMode of the current receiver. (Inherited from IReceiverClient) |
Registered |
Gets a list of currently registered plugins for this client. (Inherited from IClientEntity) |
Service |
Connection object to the service bus namespace. (Inherited from IClientEntity) |
Abandon |
Abandons a Message using a lock token. This will make the message available again for processing. (Inherited from IReceiverClient) |
Cancel |
Cancels a message that was scheduled. (Inherited from ISenderClient) |
Close |
Closes the Client. Closes the connections opened by it. (Inherited from IClientEntity) |
Complete |
Completes a Message using its lock token. This will delete the message from the queue. (Inherited from IReceiverClient) |
Dead |
Moves a message to the deadletter sub-queue. (Inherited from IReceiverClient) |
Dead |
Moves a message to the deadletter sub-queue. (Inherited from IReceiverClient) |
Register |
Receive messages continuously from the entity. Registers a message handler and begins a new thread to receive messages. This handler(Func<T1,T2,TResult>) is awaited on every time a new message is received by the receiver. (Inherited from IReceiverClient) |
Register |
Receive messages continuously from the entity. Registers a message handler and begins a new thread to receive messages. This handler(Func<T1,T2,TResult>) is awaited on every time a new message is received by the receiver. (Inherited from IReceiverClient) |
Register |
Registers a ServiceBusPlugin to be used with this client. (Inherited from IClientEntity) |
Register |
Receive session messages continuously from the queue. Registers a message handler and begins a new thread to receive session-messages. This handler(Func<T1,T2,T3,TResult>) is awaited on every time a new message is received by the queue client. |
Register |
Receive session messages continuously from the queue. Registers a message handler and begins a new thread to receive session-messages. This handler(Func<T1,T2,T3,TResult>) is awaited on every time a new message is received by the queue client. |
Schedule |
Schedules a message to appear on Service Bus. (Inherited from ISenderClient) |
Send |
Sends a list of messages to Service Bus. When called on partitioned entities, messages meant for different partitions cannot be batched together. (Inherited from ISenderClient) |
Send |
Sends a message to Service Bus. (Inherited from ISenderClient) |
Unregister |
Unregister message handler from the receiver if there is an active message handler registered. This operation waits for the completion of inflight receive and message handling operations to finish and unregisters future receives on the message handler which previously registered. (Inherited from IReceiverClient) |
Unregister |
Unregisters a ServiceBusPlugin. (Inherited from IClientEntity) |
Unregister |
Unregister session handler from the receiver if there is an active session handler registered. This operation waits for the completion of inflight receive and session handling operations to finish and unregisters future receives on the session handler which previously registered. |
Feedback su Azure SDK for .NET
Azure SDK for .NET è un progetto di open source. Selezionare un collegamento per fornire feedback: