This topic has not yet been rated - Rate this topic

TopicClient Class

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

System.Object
  Microsoft.ServiceBus.Messaging.MessageClientEntity
    Microsoft.ServiceBus.Messaging.TopicClient

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

The TopicClient type exposes the following members.

  Name Description
Protected property InternalSender Gets or sets the message sender for the topic.
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 that was used in creating this TopicClient object.
Public property Path Gets or sets the full pathname of the file.
Top
  Name Description
Public method Abort Aborts the message client entity and puts its status into a closing state. (Inherited from MessageClientEntity.)
Public method BeginClose Begins an asynchronous operation to close the message client entity. (Inherited from MessageClientEntity.)
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 EndClose Finishes an asynchronous operation to close the message client entity. (Inherited from MessageClientEntity.)
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 GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Protected method OnAbort Executes the abort action. (Overrides MessageClientEntity.OnAbort().)
Protected method OnBeginClose Executes the begin close action. (Overrides MessageClientEntity.OnBeginClose(TimeSpan, AsyncCallback, Object).)
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 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 OnEndClose Executes the end close action. (Overrides MessageClientEntity.OnEndClose(IAsyncResult).)
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 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 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 Topic
//********************************************************************************

// Create topic client
TopicClient myTopicClient = factory.CreateTopicClient(myTopic);

// Send messages
List <object> Issues = new List <object>();
foreach (var issue in Issues)
{
   myTopicClient.Send(new BrokeredMessage(issue));
}

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)