您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

TopicClient Class

Definition

An anchor class used to access a TopicDescription to perform run-time operations.

public abstract class TopicClient : Microsoft.ServiceBus.Messaging.MessagingEntityClient
type TopicClient = class
    inherit MessagingEntityClient
Public MustInherit Class TopicClient
Inherits MessagingEntityClient
Inheritance

Examples


       // Create settings for the MessagingFactory (for rutime operations)
       MessagingFactorySettings factorySettings = new MessagingFactorySettings()
       {
          NetMessagingTransportSettings = new NetMessagingTransportSettings(),
          Credential = TransportClientCredentialBase.CreateSharedSecretCredential(IssuerName, IssuerKey),
       };
      
       // Create the MessagingFactory
       MessagingFactory factory = 
       MessagingFactory.Create(myServiceBusNamespace, factorySettings);
      
       //********************************************************************************
       //                          Sending messages to a Topic
       //********************************************************************************
      
       // Create topic client
       TopicClient myTopicClient = factory.CreateTopicClient(myTopic);
      
       // Create a sender
       //MessageSender myMessageSender = myTopicClient.CreateSender(SendMode.Default);
      
       // Send messages
       List <object> Issues = new List <object>();
       foreach (var issue in Issues)
       {
          myMessageSender.Send(new BrokeredMessage(issue));
       }

Properties

IsClosed (Inherited from ClientEntity)
IsSubQueue

Gets or sets a value that indicates whether the message receiver is created from a subqueue.

MessagingFactory

Gets or sets the messaging factory that was used in creating this TopicClient object.

Path

Gets the queue's, topic's, or subscription's path relative to the MessagingFactory base address.

(Inherited from MessagingEntityClient)
RetryPolicy (Inherited from ClientEntity)
ThisLock (Inherited from ClientEntity)

Methods

Abort()

Performs abort functionality on the messaging entity.

(Inherited from ClientEntity)
CancelScheduledMessageAsync(Int64)

Cancels a scheduled message

Close()

Sends a cleanup message to Service Bus to signal the completion of the usage of an entity.

(Inherited from ClientEntity)
CloseAsync()

Sends a cleanup message asynchronously to Service Bus to signal the completion of the usage of an entity.

(Inherited from ClientEntity)
Create(String)

Creates a new instance of TopicClient.

CreateFromConnectionString(String)

Creates a new instance of TopicClient using the specified connection string.

CreateFromConnectionString(String, String)

Creates a new instance of TopicClient using the specified connection string and path to the topic. Use this overload only when the connection string does not use the EntityPath property.

CreateWithAzureActiveDirectory(Uri, String, AzureActiveDirectoryTokenProvider+AuthenticationCallback, String, Nullable<TimeSpan>, TransportType)

Creates a new instance of the TopicClient by using authentication callback .

CreateWithManagedIdentity(Uri, String, Nullable<TimeSpan>, TransportType)

Creates a new instance of the TopicClient by using Azure Managed Identity authentication.

Fault()

For internal use only. Do not inherit from this class.

(Inherited from ClientEntity)
FormatTransferDeadLetterPath(String)

A utility method that, given the topic path and subscription name, forms a full path that points to the dead letter queue of the topic's transfer topic.

OnAbort()

Executes the abort action.

OnBeginClose(TimeSpan, AsyncCallback, Object)

Executes the begin close action.

OnBeginCreateSender(TimeSpan, AsyncCallback, Object)

Executes the begin create sender action.

OnBeginOpen(TimeSpan, AsyncCallback, Object) (Inherited from ClientEntity)
OnClose(TimeSpan)

Executes the close action.

OnClosed() (Inherited from ClientEntity)
OnEndClose(IAsyncResult)

Executes the end close action.

OnEndCreateSender(IAsyncResult)

Executes the end create sender action.

OnEndOpen(IAsyncResult) (Inherited from ClientEntity)
OnFaulted() (Inherited from ClientEntity)
OnOpen(TimeSpan) (Inherited from ClientEntity)
OnOpened() (Inherited from ClientEntity)
Peek()

Peeks a BrokeredMessage from current queue/topic.

Peek(Int64)

Peeks a BrokeredMessage from current queue/topic.

PeekAsync()
PeekAsync(Int64)
PeekBatch(Int32)

Peeks a BrokeredMessage from current queue/topic.

PeekBatch(Int64, Int32)
PeekBatchAsync(Int32)
PeekBatchAsync(Int64, Int32)
ScheduleMessageAsync(BrokeredMessage, DateTimeOffset)

Sends a scheduled message

Send(BrokeredMessage)

Sends a message using the Microsoft.ServiceBus.Messaging.TopicClient.InternalSender.

SendAsync(BrokeredMessage)

Asynchronously sends a message using the Microsoft.ServiceBus.Messaging.TopicClient.InternalSender.

SendBatch(IEnumerable<BrokeredMessage>)

Sends a set of brokered messages (for batch processing).

SendBatchAsync(IEnumerable<BrokeredMessage>)

Asynchronously sends a set of brokered messages (for batch processing).

ThrowIfClosed() (Inherited from ClientEntity)
ThrowIfDisposed() (Inherited from ClientEntity)
ThrowIfDisposedOrImmutable() (Inherited from ClientEntity)
ThrowIfDisposedOrNotOpen() (Inherited from ClientEntity)
ThrowIfFaulted() (Inherited from ClientEntity)

Applies to

See also