TopicClient Class
- java.
lang. Object - ClientEntity
- com.
microsoft. azure. servicebus. InitializableEntity - com.
microsoft. azure. servicebus. TopicClient
- com.
- com.
public class TopicClient implements ITopicClient
The topic client that interacts with service bus topic.
Constructor Summary
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
cancelScheduledMessage(long sequenceNumber)
Cancels the enqueuing of an already sent scheduled message, if it was not already enqueued. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods. |
CompletableFuture<Void> |
cancelScheduledMessageAsync(long sequenceNumber)
Cancels the enqueuing of an already sent scheduled message, if it was not already enqueued. This is an asynchronous method returning a CompletableFuture which completes when the message is cancelled. |
String |
getEntityPath()
Gets the path of the entity this client is sending messages to or receiving messages from. |
String |
getTopicName()
Get the name of the topic |
CompletableFuture<Void> | onClose() |
IMessage |
peek()
reads next the active message without changing the state of the receiver or the message source. The first call to peek() fetches the first active message for this receiver. Each subsequent call fetches the subsequent message in the entity. |
IMessage |
peek(long fromSequenceNumber)
Reads next the active message without changing the state of the receiver or the message source. |
CompletableFuture<IMessage> |
peekAsync()
Asynchronously reads the active messages without changing the state of the receiver or the message source. |
CompletableFuture<IMessage> |
peekAsync(long fromSequenceNumber)
Asynchronously reads next the active message without changing the state of the receiver or the message source. |
Collection<IMessage> |
peekBatch(int messageCount)
Reads next batch of the active messages without changing the state of the receiver or the message source. |
Collection<IMessage> |
peekBatch(long fromSequenceNumber, int messageCount)
Reads next batch of the active messages without changing the state of the receiver or the message source. |
CompletableFuture<Collection<IMessage>> |
peekBatchAsync(int messageCount)
Asynchronously reads the next batch of active messages without changing the state of the receiver or the message source. |
CompletableFuture<Collection<IMessage>> |
peekBatchAsync(long fromSequenceNumber, int messageCount)
Asynchronously reads the next batch of active messages without changing the state of the receiver or the message source. |
long |
scheduleMessage(IMessage message, Instant scheduledEnqueueTimeUtc)
Sends a scheduled message to the Azure Service Bus entity this sender is connected to. A scheduled message is enqueued and made available to receivers only at the scheduled enqueue time. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods. |
long |
scheduleMessage(IMessage message, Instant scheduledEnqueueTimeUtc, TransactionContext transaction)
Sends a scheduled message to the Azure Service Bus entity this sender is connected to. A scheduled message is enqueued and made available to receivers only at the scheduled enqueue time. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods. |
CompletableFuture<Long> |
scheduleMessageAsync(IMessage message, Instant scheduledEnqueueTimeUtc)
Sends a scheduled message to the Azure Service Bus entity this sender is connected to. A scheduled message is enqueued and made available to receivers only at the scheduled enqueue time. This is an asynchronous method returning a CompletableFuture which completes when the message is sent to the entity. The CompletableFuture, on completion, returns the sequence number of the scheduled message which can be used to cancel the scheduling of the message. |
CompletableFuture<Long> |
scheduleMessageAsync(IMessage message, Instant scheduledEnqueueTimeUtc, TransactionContext transaction)
Sends a scheduled message to the Azure Service Bus entity this sender is connected to. A scheduled message is enqueued and made available to receivers only at the scheduled enqueue time. This is an asynchronous method returning a CompletableFuture which completes when the message is sent to the entity. The CompletableFuture, on completion, returns the sequence number of the scheduled message which can be used to cancel the scheduling of the message. |
void |
send(IMessage message)
Sends a message to the Azure Service Bus entity this sender is connected to. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods. |
void |
send(IMessage message, TransactionContext transaction)
Sends a message to the Azure Service Bus entity this sender is connected to. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods. |
CompletableFuture<Void> |
sendAsync(IMessage message)
Sends a message to the Azure Service Bus entity this sender is connected to. This is an asynchronous method returning a CompletableFuture which completes when the message is sent to the entity. |
CompletableFuture<Void> |
sendAsync(IMessage message, TransactionContext transaction)
Sends a message to the Azure Service Bus entity this sender is connected to. This is an asynchronous method returning a CompletableFuture which completes when the message is sent to the entity. |
void |
sendBatch(Collection<? extends IMessage> messages)
Sends a batch of messages to the Azure Service Bus entity this sender is connected to. This method blocks until the batch is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods. |
void |
sendBatch(Collection<? extends IMessage> messages, TransactionContext transaction)
Sends a batch of messages to the Azure Service Bus entity this sender is connected to. This method blocks until the batch is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods. |
CompletableFuture<Void> |
sendBatchAsync(Collection<? extends IMessage> messages)
Sends a batch of messages to the Azure Service Bus entity this sender is connected to. This is an asynchronous method returning a CompletableFuture which completes when the batch is sent to the entity. |
CompletableFuture<Void> |
sendBatchAsync(Collection<? extends IMessage> messages, TransactionContext transaction)
Sends a batch of messages to the Azure Service Bus entity this sender is connected to. This is an asynchronous method returning a CompletableFuture which completes when the batch is sent to the entity. |
Inherited Members
Constructor Details
TopicClient
public TopicClient(ConnectionStringBuilder amqpConnectionStringBuilder)
Parameters:
TopicClient
public TopicClient(String namespace, String topicPath, ClientSettings clientSettings)
Parameters:
TopicClient
public TopicClient(URI namespaceEndpointURI, String topicPath, ClientSettings clientSettings)
Parameters:
Method Details
cancelScheduledMessage
public void cancelScheduledMessage(long sequenceNumber)
Cancels the enqueuing of an already sent scheduled message, if it was not already enqueued. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods.
Overrides:
TopicClient.cancelScheduledMessage(long sequenceNumber)Parameters:
Throws:
cancelScheduledMessageAsync
public CompletableFuture
Cancels the enqueuing of an already sent scheduled message, if it was not already enqueued. This is an asynchronous method returning a CompletableFuture which completes when the message is cancelled.
Overrides:
TopicClient.cancelScheduledMessageAsync(long sequenceNumber)Parameters:
Returns:
getEntityPath
public String getEntityPath()
Gets the path of the entity this client is sending messages to or receiving messages from.
Overrides:
TopicClient.getEntityPath()Returns:
getTopicName
public String getTopicName()
Get the name of the topic
Overrides:
TopicClient.getTopicName()Returns:
onClose
protected CompletableFuture
peek
public IMessage peek()
reads next the active message without changing the state of the receiver or the message source. The first call to peek() fetches the first active message for this receiver. Each subsequent call fetches the subsequent message in the entity.
Overrides:
TopicClient.peek()Returns:
Message peeked
Throws:
peek
public IMessage peek(long fromSequenceNumber)
Reads next the active message without changing the state of the receiver or the message source.
Overrides:
TopicClient.peek(long fromSequenceNumber)Parameters:
Returns:
Message peeked
Throws:
peekAsync
public CompletableFuture
Asynchronously reads the active messages without changing the state of the receiver or the message source.
Overrides:
TopicClient.peekAsync()Returns:
Message peeked
peekAsync
public CompletableFuture
Asynchronously reads next the active message without changing the state of the receiver or the message source.
Overrides:
TopicClient.peekAsync(long fromSequenceNumber)Parameters:
Returns:
peekBatch
public Collection
Reads next batch of the active messages without changing the state of the receiver or the message source.
Overrides:
TopicClient.peekBatch(int messageCount)Parameters:
Returns:
Throws:
peekBatch
public Collection
Reads next batch of the active messages without changing the state of the receiver or the message source.
Overrides:
TopicClient.peekBatch(long fromSequenceNumber, int messageCount)Parameters:
Returns:
Throws:
peekBatchAsync
public CompletableFuture
Asynchronously reads the next batch of active messages without changing the state of the receiver or the message source.
Overrides:
TopicClient.peekBatchAsync(int messageCount)Parameters:
Returns:
peekBatchAsync
public CompletableFuture
Asynchronously reads the next batch of active messages without changing the state of the receiver or the message source.
Overrides:
TopicClient.peekBatchAsync(long fromSequenceNumber, int messageCount)Parameters:
Returns:
scheduleMessage
public long scheduleMessage(IMessage message, Instant scheduledEnqueueTimeUtc)
Sends a scheduled message to the Azure Service Bus entity this sender is connected to. A scheduled message is enqueued and made available to receivers only at the scheduled enqueue time. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods.
Overrides:
TopicClient.scheduleMessage(IMessage message, Instant scheduledEnqueueTimeUtc)Parameters:
Returns:
Throws:
scheduleMessage
public long scheduleMessage(IMessage message, Instant scheduledEnqueueTimeUtc, TransactionContext transaction)
Sends a scheduled message to the Azure Service Bus entity this sender is connected to. A scheduled message is enqueued and made available to receivers only at the scheduled enqueue time. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods.
Overrides:
TopicClient.scheduleMessage(IMessage message, Instant scheduledEnqueueTimeUtc, TransactionContext transaction)Parameters:
TransactionContext which this operation should enlist to.
Returns:
Throws:
scheduleMessageAsync
public CompletableFuture
Sends a scheduled message to the Azure Service Bus entity this sender is connected to. A scheduled message is enqueued and made available to receivers only at the scheduled enqueue time. This is an asynchronous method returning a CompletableFuture which completes when the message is sent to the entity. The CompletableFuture, on completion, returns the sequence number of the scheduled message which can be used to cancel the scheduling of the message.
Overrides:
TopicClient.scheduleMessageAsync(IMessage message, Instant scheduledEnqueueTimeUtc)Parameters:
Returns:
scheduleMessageAsync
public CompletableFuture
Sends a scheduled message to the Azure Service Bus entity this sender is connected to. A scheduled message is enqueued and made available to receivers only at the scheduled enqueue time. This is an asynchronous method returning a CompletableFuture which completes when the message is sent to the entity. The CompletableFuture, on completion, returns the sequence number of the scheduled message which can be used to cancel the scheduling of the message.
Overrides:
TopicClient.scheduleMessageAsync(IMessage message, Instant scheduledEnqueueTimeUtc, TransactionContext transaction)Parameters:
TransactionContext which this operation should enlist to.
Returns:
send
public void send(IMessage message)
Sends a message to the Azure Service Bus entity this sender is connected to. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods.
Overrides:
TopicClient.send(IMessage message)Parameters:
Throws:
send
public void send(IMessage message, TransactionContext transaction)
Sends a message to the Azure Service Bus entity this sender is connected to. This method blocks until the message is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods.
Overrides:
TopicClient.send(IMessage message, TransactionContext transaction)Parameters:
TransactionContext which this operation should enlist to.
Throws:
sendAsync
public CompletableFuture
Sends a message to the Azure Service Bus entity this sender is connected to. This is an asynchronous method returning a CompletableFuture which completes when the message is sent to the entity.
Overrides:
TopicClient.sendAsync(IMessage message)Parameters:
Returns:
sendAsync
public CompletableFuture
Sends a message to the Azure Service Bus entity this sender is connected to. This is an asynchronous method returning a CompletableFuture which completes when the message is sent to the entity.
Overrides:
TopicClient.sendAsync(IMessage message, TransactionContext transaction)Parameters:
TransactionContext which this operation should enlist to.
Returns:
sendBatch
public void sendBatch(Collection messages)
Sends a batch of messages to the Azure Service Bus entity this sender is connected to. This method blocks until the batch is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods.
Overrides:
TopicClient.sendBatch(Collection<? extends IMessage> messages)Parameters:
Throws:
sendBatch
public void sendBatch(Collection messages, TransactionContext transaction)
Sends a batch of messages to the Azure Service Bus entity this sender is connected to. This method blocks until the batch is sent to the entity. Calling this method is equivalent to calling . For better performance, use async methods.
Overrides:
TopicClient.sendBatch(Collection<? extends IMessage> messages, TransactionContext transaction)Parameters:
TransactionContext which this operation should enlist to.
Throws:
sendBatchAsync
public CompletableFuture
Sends a batch of messages to the Azure Service Bus entity this sender is connected to. This is an asynchronous method returning a CompletableFuture which completes when the batch is sent to the entity.
Overrides:
TopicClient.sendBatchAsync(Collection<? extends IMessage> messages)Parameters:
Returns:
sendBatchAsync
public CompletableFuture
Sends a batch of messages to the Azure Service Bus entity this sender is connected to. This is an asynchronous method returning a CompletableFuture which completes when the batch is sent to the entity.
Overrides:
TopicClient.sendBatchAsync(Collection<? extends IMessage> messages, TransactionContext transaction)Parameters:
TransactionContext which this operation should enlist to.
Returns:
Applies to
Azure SDK for Java