TopicClient TopicClient Class

Definition

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

public abstract class TopicClient : Microsoft.ServiceBus.Messaging.ClientEntity
Public MustInherit Class TopicClient
Inherits ClientEntity
Inheritance
TopicClientTopicClient

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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

         // 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  Issues = new List ();
         foreach (var issue in Issues)
         {
            myMessageSender.Send(new BrokeredMessage(issue));
         }
         

Properties

IsClosed IsClosed Inherited from ClientEntity
IsSubQueue IsSubQueue

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

MessagingFactory MessagingFactory

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

Path Path

Gets or sets the full pathname of the file.

RetryPolicy RetryPolicy Inherited from ClientEntity
ThisLock ThisLock Inherited from ClientEntity

Methods

Abort() Abort() Inherited from ClientEntity
CancelScheduledMessageAsync(Int64) CancelScheduledMessageAsync(Int64)

Cancels a scheduled message

Close() Close() Inherited from ClientEntity
CloseAsync() CloseAsync() Inherited from ClientEntity
Create(String) Create(String)

Creates a new instance of TopicClient.

CreateFromConnectionString(String) CreateFromConnectionString(String)

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

CreateFromConnectionString(String, String) CreateFromConnectionString(String, String)

w 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.

Fault() Fault() Inherited from ClientEntity
FormatTransferDeadLetterPath(String) FormatTransferDeadLetterPath(String)

thod 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() OnAbort()

Executes the abort action.

OnBeginClose(TimeSpan, AsyncCallback, Object) OnBeginClose(TimeSpan, AsyncCallback, Object)

Executes the begin close action.

OnBeginCreateSender(TimeSpan, AsyncCallback, Object) OnBeginCreateSender(TimeSpan, AsyncCallback, Object)

Executes the begin create sender action.

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

Executes the close action.

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

Executes the end close action.

OnEndCreateSender(IAsyncResult) OnEndCreateSender(IAsyncResult)

Executes the end create sender action.

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

Peeks a BrokeredMessage from current queue/topic.

Peek(Int64) Peek(Int64)

Peeks a BrokeredMessage from current queue/topic.

PeekAsync() PeekAsync()
PeekAsync(Int64) PeekAsync(Int64)
PeekBatch(Int32) PeekBatch(Int32)

Peeks a BrokeredMessage from current queue/topic.

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

Sends a scheduled message

Send(BrokeredMessage) Send(BrokeredMessage)

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

SendAsync(BrokeredMessage) SendAsync(BrokeredMessage)

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

SendBatch(IEnumerable<BrokeredMessage>) SendBatch(IEnumerable<BrokeredMessage>)

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

SendBatchAsync(IEnumerable<BrokeredMessage>) SendBatchAsync(IEnumerable<BrokeredMessage>)

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

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

Extension Methods

IsDefined(Object) IsDefined(Object)

Determines if a certain property is defined or not.

IsNull(Object) IsNull(Object)

Determines if a certain property is null or not.

IsPrimitive(Object) IsPrimitive(Object)

Determines if a certain property is of premitive JSON type.

Applies to

See Also