Class TopicClient
- Namespace
- Microsoft.ServiceBus.Messaging
- Assembly
- Microsoft.ServiceBus.dll
An anchor class used to access a Microsoft.ServiceBus.Messaging.Topic to perform run-time operations.
public abstract class TopicClient : ClientEntity
- Inheritance
-
TopicClient
- Inherited Members
Properties
IsSubQueue
Gets or sets a value that indicates whether the message receiver is created from a subqueue.
protected bool IsSubQueue { get; }
Property Value
- bool
true if the message receiver is created from a subqueue; otherwise, false.
MessagingFactory
Gets or sets the messaging factory that was used in creating this TopicClient object.
public MessagingFactory MessagingFactory { get; }
Property Value
- MessagingFactory
The messaging factory that was used in creating this TopicClient object.
Path
Gets or sets the full pathname of the file.
public string Path { get; }
Property Value
- string
The full pathname of the file.
Methods
Create(string)
Creates a new instance of TopicClient.
public static TopicClient Create(string path)
Parameters
path
stringThe path.
Returns
- TopicClient
The created TopicClient.
CreateFromConnectionString(string)
public static TopicClient CreateFromConnectionString(string connectionString)
Parameters
connectionString
string
Returns
CreateFromConnectionString(string, string)
Creates a new instance of TopicClientusing a specified connection string.
public static TopicClient CreateFromConnectionString(string connectionString, string path)
Parameters
Returns
- TopicClient
The created TopicClient.
FormatTransferDeadLetterPath(string)
public static string FormatTransferDeadLetterPath(string topicPath)
Parameters
topicPath
string
Returns
OnAbort()
Executes the abort action.
protected override void OnAbort()
OnBeginClose(TimeSpan, AsyncCallback, object)
Executes the begin close action.
protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
Parameters
timeout
TimeSpanThe wait time before the operation times out.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains information about the receive operation. This object is passed to the EndClose delegate when the operation is complete.
Returns
- IAsyncResult
An IAsyncResult that references the asynchronous Close operation.
OnBeginCreateSender(TimeSpan, AsyncCallback, object)
Executes the begin create sender action.
protected abstract IAsyncResult OnBeginCreateSender(TimeSpan timeout, AsyncCallback callback, object state)
Parameters
timeout
TimeSpanThe wait time before the operation times out.
callback
AsyncCallbackAn AsyncCallback delegate that references the method to invoke when the operation is complete.
state
objectA user-defined object that contains information about the receive operation. This object is passed to the Microsoft.ServiceBus.Messaging.TopicClient.EndCreateSender(System.IAsyncResult) when the operation is complete.
Returns
- IAsyncResult
An IAsyncResult that references the asynchronous Microsoft.ServiceBus.Messaging.TopicClient.CreateSender.
OnClose(TimeSpan)
Executes the close action.
protected override void OnClose(TimeSpan timeout)
Parameters
timeout
TimeSpanThe wait time before the operation times out.
OnEndClose(IAsyncResult)
Executes the end close action.
protected override void OnEndClose(IAsyncResult result)
Parameters
result
IAsyncResultAn IAsyncResult that references the asynchronous Close operation.
OnEndCreateSender(IAsyncResult)
Executes the end create sender action.
protected abstract MessageSender OnEndCreateSender(IAsyncResult result)
Parameters
result
IAsyncResultAn IAsyncResult that references the asynchronous Microsoft.ServiceBus.Messaging.TopicClient.CreateSender.
Returns
- MessageSender
The newly created MessageSender object.
Peek()
public BrokeredMessage Peek()
Returns
Peek(long)
public BrokeredMessage Peek(long fromSequenceNumber)
Parameters
fromSequenceNumber
long
Returns
PeekAsync()
public Task<BrokeredMessage> PeekAsync()
Returns
PeekAsync(long)
public Task<BrokeredMessage> PeekAsync(long fromSequenceNumber)
Parameters
fromSequenceNumber
long
Returns
PeekBatch(int)
public IEnumerable<BrokeredMessage> PeekBatch(int messageCount)
Parameters
messageCount
int
Returns
PeekBatch(long, int)
public IEnumerable<BrokeredMessage> PeekBatch(long fromSequenceNumber, int messageCount)
Parameters
Returns
PeekBatchAsync(int)
public Task<IEnumerable<BrokeredMessage>> PeekBatchAsync(int messageCount)
Parameters
messageCount
int
Returns
PeekBatchAsync(long, int)
public Task<IEnumerable<BrokeredMessage>> PeekBatchAsync(long fromSequenceNumber, int messageCount)
Parameters
Returns
Send(BrokeredMessage)
Sends a message using the Microsoft.ServiceBus.Messaging.QueueClient.InternalSender.
public void Send(BrokeredMessage message)
Parameters
message
BrokeredMessageThe message to send.
Exceptions
- TimeoutException
Thrown when operation times out. Timeout period is initialized through the OperationTimeout to avoid this exception if timeout value is relatively low.
- ArgumentException
Thrown when the BrokeredMessage is null.
- InvalidOperationException
Thrown if the
message
has already been sent by a TopicClient or MessageSender once already.- OperationCanceledException
Thrown if the client entity has been closed or aborted.
- UnauthorizedAccessException
Thrown if there is an I/O or security error.
- SerializationException
Thrown when an error occurs during serialization or deserialization.
- MessagingEntityNotFoundException
Thrown if the topic does not exist.
- MessagingException
Thrown if there is a messaging error.
SendAsync(BrokeredMessage)
Asynchronously sends a message using the Microsoft.ServiceBus.Messaging.QueueClient.InternalSender.
public Task SendAsync(BrokeredMessage message)
Parameters
message
BrokeredMessageThe message to send.
Returns
- Task
The asynchronous result of the operation.
SendBatch(IEnumerable<BrokeredMessage>)
Sends a set of brokered messages (for batch processing).
public void SendBatch(IEnumerable<BrokeredMessage> messages)
Parameters
messages
IEnumerable<BrokeredMessage>The messages to send.
SendBatchAsync(IEnumerable<BrokeredMessage>)
Asynchronously sends a set of brokered messages (for batch processing).
public Task SendBatchAsync(IEnumerable<BrokeredMessage> messages)
Parameters
messages
IEnumerable<BrokeredMessage>The messages to send.
Returns
- Task
The asynchronous result of the operation.