azure-docs-sdk-java/docs-ref-autogen/com.azure.messaging.service...

326 строки
42 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient"
name: "ServiceBusSenderAsyncClient"
nameWithType: "ServiceBusSenderAsyncClient"
summary: "An **asynchronous** client to send messages to a Service Bus resource."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public final class **ServiceBusSenderAsyncClient**</br> implements <a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html\">AutoCloseable</a>"
methods:
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.cancelScheduledMessage(long)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.cancelScheduledMessage(long sequenceNumber)"
name: "cancelScheduledMessage(long sequenceNumber)"
nameWithType: "ServiceBusSenderAsyncClient.cancelScheduledMessage(long sequenceNumber)"
summary: "Cancels the enqueuing of a scheduled message, if it was not already enqueued."
parameters:
- description: "of the scheduled message to cancel."
name: "sequenceNumber"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Void> cancelScheduledMessage(long sequenceNumber)"
desc: "Cancels the enqueuing of a scheduled message, if it was not already enqueued."
returns:
description: "The <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> that finishes this operation on service bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.cancelScheduledMessages(java.lang.Iterable<java.lang.Long>)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.cancelScheduledMessages(Iterable<Long> sequenceNumbers)"
name: "cancelScheduledMessages(Iterable<Long> sequenceNumbers)"
nameWithType: "ServiceBusSenderAsyncClient.cancelScheduledMessages(Iterable<Long> sequenceNumbers)"
summary: "Cancels the enqueuing of an already scheduled message, if it was not already enqueued."
parameters:
- description: "of the scheduled messages to cancel."
name: "sequenceNumbers"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>&gt;"
syntax: "public Mono<Void> cancelScheduledMessages(Iterable<Long> sequenceNumbers)"
desc: "Cancels the enqueuing of an already scheduled message, if it was not already enqueued."
returns:
description: "The <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> that finishes this operation on service bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.close()"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.close()"
name: "close()"
nameWithType: "ServiceBusSenderAsyncClient.close()"
summary: "Disposes of the <xref uid=\"com.azure.messaging.servicebus.ServiceBusSenderAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusSenderAsyncClient\"></xref>."
syntax: "public void close()"
desc: "Disposes of the <xref uid=\"com.azure.messaging.servicebus.ServiceBusSenderAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusSenderAsyncClient\"></xref>. If the client has a dedicated connection, the underlying connection is also closed."
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.commitTransaction(com.azure.messaging.servicebus.ServiceBusTransactionContext)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.commitTransaction(ServiceBusTransactionContext transactionContext)"
name: "commitTransaction(ServiceBusTransactionContext transactionContext)"
nameWithType: "ServiceBusSenderAsyncClient.commitTransaction(ServiceBusTransactionContext transactionContext)"
summary: "Commits the transaction given <xref uid=\"com.azure.messaging.servicebus.ServiceBusTransactionContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusTransactionContext\"></xref>."
parameters:
- description: "to be committed."
name: "transactionContext"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusTransactionContext?alt=com.azure.messaging.servicebus.ServiceBusTransactionContext&text=ServiceBusTransactionContext\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Void> commitTransaction(ServiceBusTransactionContext transactionContext)"
desc: "Commits the transaction given <xref uid=\"com.azure.messaging.servicebus.ServiceBusTransactionContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusTransactionContext\"></xref>. This will make a call to Service Bus."
returns:
description: "The <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> that finishes this operation on Service Bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.createMessageBatch()"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.createMessageBatch()"
name: "createMessageBatch()"
nameWithType: "ServiceBusSenderAsyncClient.createMessageBatch()"
summary: "Creates a <xref uid=\"com.azure.messaging.servicebus.ServiceBusMessageBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusMessageBatch\"></xref> that can fit as many messages as the transport allows."
syntax: "public Mono<ServiceBusMessageBatch> createMessageBatch()"
desc: "Creates a <xref uid=\"com.azure.messaging.servicebus.ServiceBusMessageBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusMessageBatch\"></xref> that can fit as many messages as the transport allows."
returns:
description: "A <xref uid=\"com.azure.messaging.servicebus.ServiceBusMessageBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusMessageBatch\"></xref> that can fit as many messages as the transport allows."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.messaging.servicebus.ServiceBusMessageBatch?alt=com.azure.messaging.servicebus.ServiceBusMessageBatch&text=ServiceBusMessageBatch\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.createMessageBatch(com.azure.messaging.servicebus.models.CreateMessageBatchOptions)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.createMessageBatch(CreateMessageBatchOptions options)"
name: "createMessageBatch(CreateMessageBatchOptions options)"
nameWithType: "ServiceBusSenderAsyncClient.createMessageBatch(CreateMessageBatchOptions options)"
summary: "Creates an <xref uid=\"com.azure.messaging.servicebus.ServiceBusMessageBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusMessageBatch\"></xref> configured with the options specified."
parameters:
- description: "A set of options used to configure the <xref uid=\"com.azure.messaging.servicebus.ServiceBusMessageBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusMessageBatch\"></xref>."
name: "options"
type: "<xref href=\"com.azure.messaging.servicebus.models.CreateMessageBatchOptions?alt=com.azure.messaging.servicebus.models.CreateMessageBatchOptions&text=CreateMessageBatchOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<ServiceBusMessageBatch> createMessageBatch(CreateMessageBatchOptions options)"
desc: "Creates an <xref uid=\"com.azure.messaging.servicebus.ServiceBusMessageBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusMessageBatch\"></xref> configured with the options specified."
returns:
description: "A new <xref uid=\"com.azure.messaging.servicebus.ServiceBusMessageBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusMessageBatch\"></xref> configured with the given options."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.messaging.servicebus.ServiceBusMessageBatch?alt=com.azure.messaging.servicebus.ServiceBusMessageBatch&text=ServiceBusMessageBatch\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.createTransaction()"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.createTransaction()"
name: "createTransaction()"
nameWithType: "ServiceBusSenderAsyncClient.createTransaction()"
summary: "Starts a new transaction on Service Bus."
syntax: "public Mono<ServiceBusTransactionContext> createTransaction()"
desc: "Starts a new transaction on Service Bus. The <xref uid=\"com.azure.messaging.servicebus.ServiceBusTransactionContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusTransactionContext\"></xref> should be passed along with <xref uid=\"com.azure.messaging.servicebus.ServiceBusReceivedMessage\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusReceivedMessage\"></xref> all operations that needs to be in this transaction."
returns:
description: "A new <xref uid=\"com.azure.messaging.servicebus.ServiceBusTransactionContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusTransactionContext\"></xref>."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.messaging.servicebus.ServiceBusTransactionContext?alt=com.azure.messaging.servicebus.ServiceBusTransactionContext&text=ServiceBusTransactionContext\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.getEntityPath()"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.getEntityPath()"
name: "getEntityPath()"
nameWithType: "ServiceBusSenderAsyncClient.getEntityPath()"
summary: "Gets the name of the Service Bus resource."
syntax: "public String getEntityPath()"
desc: "Gets the name of the Service Bus resource."
returns:
description: "The name of the Service Bus resource."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.getFullyQualifiedNamespace()"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.getFullyQualifiedNamespace()"
name: "getFullyQualifiedNamespace()"
nameWithType: "ServiceBusSenderAsyncClient.getFullyQualifiedNamespace()"
summary: "Gets the fully qualified namespace."
syntax: "public String getFullyQualifiedNamespace()"
desc: "Gets the fully qualified namespace."
returns:
description: "The fully qualified namespace."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.getIdentifier()"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.getIdentifier()"
name: "getIdentifier()"
nameWithType: "ServiceBusSenderAsyncClient.getIdentifier()"
summary: "Gets the identifier of the instance of <xref uid=\"com.azure.messaging.servicebus.ServiceBusSenderAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusSenderAsyncClient\"></xref>."
syntax: "public String getIdentifier()"
desc: "Gets the identifier of the instance of <xref uid=\"com.azure.messaging.servicebus.ServiceBusSenderAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusSenderAsyncClient\"></xref>."
returns:
description: "The identifier that can identify the instance of <xref uid=\"com.azure.messaging.servicebus.ServiceBusSenderAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusSenderAsyncClient\"></xref>."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.rollbackTransaction(com.azure.messaging.servicebus.ServiceBusTransactionContext)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.rollbackTransaction(ServiceBusTransactionContext transactionContext)"
name: "rollbackTransaction(ServiceBusTransactionContext transactionContext)"
nameWithType: "ServiceBusSenderAsyncClient.rollbackTransaction(ServiceBusTransactionContext transactionContext)"
summary: "Rollbacks the transaction given <xref uid=\"com.azure.messaging.servicebus.ServiceBusTransactionContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusTransactionContext\"></xref>."
parameters:
- description: "Transaction to rollback."
name: "transactionContext"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusTransactionContext?alt=com.azure.messaging.servicebus.ServiceBusTransactionContext&text=ServiceBusTransactionContext\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Void> rollbackTransaction(ServiceBusTransactionContext transactionContext)"
desc: "Rollbacks the transaction given <xref uid=\"com.azure.messaging.servicebus.ServiceBusTransactionContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusTransactionContext\"></xref>. This will make a call to Service Bus."
returns:
description: "The <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> that finishes this operation on the Service Bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.scheduleMessage(com.azure.messaging.servicebus.ServiceBusMessage,java.time.OffsetDateTime)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.scheduleMessage(ServiceBusMessage message, OffsetDateTime scheduledEnqueueTime)"
name: "scheduleMessage(ServiceBusMessage message, OffsetDateTime scheduledEnqueueTime)"
nameWithType: "ServiceBusSenderAsyncClient.scheduleMessage(ServiceBusMessage message, OffsetDateTime scheduledEnqueueTime)"
summary: "Sends a scheduled message to the Azure Service Bus entity this sender is connected to."
parameters:
- description: "Message to be sent to the Service Bus Queue."
name: "message"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusMessage?alt=com.azure.messaging.servicebus.ServiceBusMessage&text=ServiceBusMessage\" data-throw-if-not-resolved=\"False\" />"
- description: "OffsetDateTime at which the message should appear in the Service Bus queue or topic."
name: "scheduledEnqueueTime"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html\">OffsetDateTime</a>"
syntax: "public Mono<Long> scheduleMessage(ServiceBusMessage message, OffsetDateTime scheduledEnqueueTime)"
desc: "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."
returns:
description: "The sequence number of the scheduled message which can be used to cancel the scheduling of the message."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.scheduleMessage(com.azure.messaging.servicebus.ServiceBusMessage,java.time.OffsetDateTime,com.azure.messaging.servicebus.ServiceBusTransactionContext)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.scheduleMessage(ServiceBusMessage message, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext)"
name: "scheduleMessage(ServiceBusMessage message, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext)"
nameWithType: "ServiceBusSenderAsyncClient.scheduleMessage(ServiceBusMessage message, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext)"
summary: "Sends a scheduled message to the Azure Service Bus entity this sender is connected to."
parameters:
- description: "Message to be sent to the Service Bus Queue."
name: "message"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusMessage?alt=com.azure.messaging.servicebus.ServiceBusMessage&text=ServiceBusMessage\" data-throw-if-not-resolved=\"False\" />"
- description: "OffsetDateTime at which the message should appear in the Service Bus queue or topic."
name: "scheduledEnqueueTime"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html\">OffsetDateTime</a>"
- description: "to be set on message before sending to Service Bus."
name: "transactionContext"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusTransactionContext?alt=com.azure.messaging.servicebus.ServiceBusTransactionContext&text=ServiceBusTransactionContext\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Long> scheduleMessage(ServiceBusMessage message, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext)"
desc: "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."
returns:
description: "The sequence number of the scheduled message which can be used to cancel the scheduling of the message."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.scheduleMessages(java.lang.Iterable<com.azure.messaging.servicebus.ServiceBusMessage>,java.time.OffsetDateTime)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime)"
name: "scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime)"
nameWithType: "ServiceBusSenderAsyncClient.scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime)"
summary: "Sends a batch of scheduled messages to the Azure Service Bus entity this sender is connected to."
parameters:
- description: "Messages to be sent to the Service Bus queue or topic."
name: "messages"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<xref href=\"com.azure.messaging.servicebus.ServiceBusMessage?alt=com.azure.messaging.servicebus.ServiceBusMessage&text=ServiceBusMessage\" data-throw-if-not-resolved=\"False\" />&gt;"
- description: "OffsetDateTime at which the message should appear in the Service Bus queue or topic."
name: "scheduledEnqueueTime"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html\">OffsetDateTime</a>"
syntax: "public Flux<Long> scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime)"
desc: "Sends a batch of scheduled messages 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."
returns:
description: "Sequence numbers of the scheduled messages which can be used to cancel the messages."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html\">Flux</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.scheduleMessages(java.lang.Iterable<com.azure.messaging.servicebus.ServiceBusMessage>,java.time.OffsetDateTime,com.azure.messaging.servicebus.ServiceBusTransactionContext)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext)"
name: "scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext)"
nameWithType: "ServiceBusSenderAsyncClient.scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext)"
summary: "Sends a scheduled messages to the Azure Service Bus entity this sender is connected to."
parameters:
- description: "Messages to be sent to the Service Bus Queue."
name: "messages"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<xref href=\"com.azure.messaging.servicebus.ServiceBusMessage?alt=com.azure.messaging.servicebus.ServiceBusMessage&text=ServiceBusMessage\" data-throw-if-not-resolved=\"False\" />&gt;"
- description: "OffsetDateTime at which the messages should appear in the Service Bus queue or topic."
name: "scheduledEnqueueTime"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html\">OffsetDateTime</a>"
- description: "Transaction to associate with the operation."
name: "transactionContext"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusTransactionContext?alt=com.azure.messaging.servicebus.ServiceBusTransactionContext&text=ServiceBusTransactionContext\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Flux<Long> scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext)"
desc: "Sends a scheduled messages 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."
returns:
description: "Sequence numbers of the scheduled messages which can be used to cancel the messages."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html\">Flux</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessage(com.azure.messaging.servicebus.ServiceBusMessage)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessage(ServiceBusMessage message)"
name: "sendMessage(ServiceBusMessage message)"
nameWithType: "ServiceBusSenderAsyncClient.sendMessage(ServiceBusMessage message)"
summary: "Sends a message to a Service Bus queue or topic."
parameters:
- description: "Message to be sent to Service Bus queue or topic."
name: "message"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusMessage?alt=com.azure.messaging.servicebus.ServiceBusMessage&text=ServiceBusMessage\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Void> sendMessage(ServiceBusMessage message)"
desc: "Sends a message to a Service Bus queue or topic."
returns:
description: "The <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> the finishes this operation on service bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessage(com.azure.messaging.servicebus.ServiceBusMessage,com.azure.messaging.servicebus.ServiceBusTransactionContext)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessage(ServiceBusMessage message, ServiceBusTransactionContext transactionContext)"
name: "sendMessage(ServiceBusMessage message, ServiceBusTransactionContext transactionContext)"
nameWithType: "ServiceBusSenderAsyncClient.sendMessage(ServiceBusMessage message, ServiceBusTransactionContext transactionContext)"
summary: "Sends a message to a Service Bus queue or topic."
parameters:
- description: "Message to be sent to Service Bus queue or topic."
name: "message"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusMessage?alt=com.azure.messaging.servicebus.ServiceBusMessage&text=ServiceBusMessage\" data-throw-if-not-resolved=\"False\" />"
- description: "to be set on batch message before sending to Service Bus."
name: "transactionContext"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusTransactionContext?alt=com.azure.messaging.servicebus.ServiceBusTransactionContext&text=ServiceBusTransactionContext\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Void> sendMessage(ServiceBusMessage message, ServiceBusTransactionContext transactionContext)"
desc: "Sends a message to a Service Bus queue or topic."
returns:
description: "The <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> the finishes this operation on service bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessages(com.azure.messaging.servicebus.ServiceBusMessageBatch)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessages(ServiceBusMessageBatch batch)"
name: "sendMessages(ServiceBusMessageBatch batch)"
nameWithType: "ServiceBusSenderAsyncClient.sendMessages(ServiceBusMessageBatch batch)"
summary: "Sends a message batch to the Azure Service Bus entity this sender is connected to."
parameters:
- description: "of messages which allows client to send maximum allowed size for a batch of messages."
name: "batch"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusMessageBatch?alt=com.azure.messaging.servicebus.ServiceBusMessageBatch&text=ServiceBusMessageBatch\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Void> sendMessages(ServiceBusMessageBatch batch)"
desc: "Sends a message batch to the Azure Service Bus entity this sender is connected to."
returns:
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> the finishes this operation on service bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessages(com.azure.messaging.servicebus.ServiceBusMessageBatch,com.azure.messaging.servicebus.ServiceBusTransactionContext)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessages(ServiceBusMessageBatch batch, ServiceBusTransactionContext transactionContext)"
name: "sendMessages(ServiceBusMessageBatch batch, ServiceBusTransactionContext transactionContext)"
nameWithType: "ServiceBusSenderAsyncClient.sendMessages(ServiceBusMessageBatch batch, ServiceBusTransactionContext transactionContext)"
summary: "Sends a message batch to the Azure Service Bus entity this sender is connected to."
parameters:
- description: "of messages which allows client to send maximum allowed size for a batch of messages."
name: "batch"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusMessageBatch?alt=com.azure.messaging.servicebus.ServiceBusMessageBatch&text=ServiceBusMessageBatch\" data-throw-if-not-resolved=\"False\" />"
- description: "to be set on batch message before sending to Service Bus."
name: "transactionContext"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusTransactionContext?alt=com.azure.messaging.servicebus.ServiceBusTransactionContext&text=ServiceBusTransactionContext\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Void> sendMessages(ServiceBusMessageBatch batch, ServiceBusTransactionContext transactionContext)"
desc: "Sends a message batch to the Azure Service Bus entity this sender is connected to."
returns:
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> the finishes this operation on service bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessages(java.lang.Iterable<com.azure.messaging.servicebus.ServiceBusMessage>)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessages(Iterable<ServiceBusMessage> messages)"
name: "sendMessages(Iterable<ServiceBusMessage> messages)"
nameWithType: "ServiceBusSenderAsyncClient.sendMessages(Iterable<ServiceBusMessage> messages)"
summary: "Sends a set of messages to a Service Bus queue or topic using a batched approach."
parameters:
- description: "Messages to be sent to Service Bus queue or topic."
name: "messages"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<xref href=\"com.azure.messaging.servicebus.ServiceBusMessage?alt=com.azure.messaging.servicebus.ServiceBusMessage&text=ServiceBusMessage\" data-throw-if-not-resolved=\"False\" />&gt;"
syntax: "public Mono<Void> sendMessages(Iterable<ServiceBusMessage> messages)"
desc: "Sends a set of messages to a Service Bus queue or topic using a batched approach. If the size of messages exceed the maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message size is the max amount allowed on the link."
returns:
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> that completes when all messages have been sent to the Service Bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessages(java.lang.Iterable<com.azure.messaging.servicebus.ServiceBusMessage>,com.azure.messaging.servicebus.ServiceBusTransactionContext)"
fullName: "com.azure.messaging.servicebus.ServiceBusSenderAsyncClient.sendMessages(Iterable<ServiceBusMessage> messages, ServiceBusTransactionContext transactionContext)"
name: "sendMessages(Iterable<ServiceBusMessage> messages, ServiceBusTransactionContext transactionContext)"
nameWithType: "ServiceBusSenderAsyncClient.sendMessages(Iterable<ServiceBusMessage> messages, ServiceBusTransactionContext transactionContext)"
summary: "Sends a set of messages to a Service Bus queue or topic using a batched approach."
parameters:
- description: "Messages to be sent to Service Bus queue or topic."
name: "messages"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<xref href=\"com.azure.messaging.servicebus.ServiceBusMessage?alt=com.azure.messaging.servicebus.ServiceBusMessage&text=ServiceBusMessage\" data-throw-if-not-resolved=\"False\" />&gt;"
- description: "to be set on batch message before sending to Service Bus."
name: "transactionContext"
type: "<xref href=\"com.azure.messaging.servicebus.ServiceBusTransactionContext?alt=com.azure.messaging.servicebus.ServiceBusTransactionContext&text=ServiceBusTransactionContext\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Void> sendMessages(Iterable<ServiceBusMessage> messages, ServiceBusTransactionContext transactionContext)"
desc: "Sends a set of messages to a Service Bus queue or topic using a batched approach. If the size of messages exceed the maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message size is the max amount allowed on the link."
returns:
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> that completes when all messages have been sent to the Service Bus resource."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
type: "class"
desc: "An **asynchronous** client to send messages to a Service Bus resource.\n\nThe examples shown in this document use a credential object named DefaultAzureCredential for authentication, which is appropriate for most scenarios, including local development and production environments. Additionally, we recommend using [managed identity][] for authentication in production environments. You can find more information on different ways of authenticating and their corresponding credential types in the [Azure Identity documentation\"][Azure Identity documentation].\n\n**Sample: Create an instance of sender**\n\n```java\nTokenCredential credential = new DefaultAzureCredentialBuilder().build();\n\n // 'fullyQualifiedNamespace' will look similar to \"{your-namespace}.servicebus.windows.net\"\n ServiceBusSenderAsyncClient asyncSender = new ServiceBusClientBuilder()\n .credential(fullyQualifiedNamespace, credential)\n .sender()\n .queueName(queueName)\n .buildAsyncClient();\n\n // When users are done with the sender, they should dispose of it.\n // Clients should be long-lived objects as they require resources\n // and time to establish a connection to the service.\n asyncSender.close();\n```\n\n**Sample: Send messages to a Service Bus resource**\n\n```java\n// `subscribe` is a non-blocking call. The program will move onto the next line of code when it starts the\n // operation. Users should use the callbacks on `subscribe` to understand the status of the send operation.\n asyncSender.createMessageBatch().flatMap(batch -> {\n batch.tryAddMessage(new ServiceBusMessage(\"test-1\"));\n batch.tryAddMessage(new ServiceBusMessage(\"test-2\"));\n return asyncSender.sendMessages(batch);\n }).subscribe(unused -> {\n }, error -> {\n System.err.println(\"Error occurred while sending batch:\" + error);\n }, () -> {\n System.out.println(\"Send complete.\");\n });\n```\n\n**Sample: Send messages using a size-limited <xref uid=\"com.azure.messaging.servicebus.ServiceBusMessageBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusMessageBatch\"></xref> to a Service Bus resource** \n\n```java\nFlux<ServiceBusMessage> telemetryMessages = Flux.just(firstMessage, secondMessage);\n\n // Setting `setMaximumSizeInBytes` when creating a batch, limits the size of that batch.\n // In this case, all the batches created with these options are limited to 256 bytes.\n CreateMessageBatchOptions options = new CreateMessageBatchOptions()\n .setMaximumSizeInBytes(256);\n AtomicReference<ServiceBusMessageBatch> currentBatch = new AtomicReference<>();\n\n // Sends the current batch if it is not null and not empty. If the current batch is null, sets it.\n // Returns the batch to work with.\n Mono<ServiceBusMessageBatch> sendBatchAndGetCurrentBatchOperation = Mono.defer(() -> {\n ServiceBusMessageBatch batch = currentBatch.get();\n\n if (batch == null) {\n return asyncSender.createMessageBatch(options);\n }\n\n if (batch.getCount() > 0) {\n return asyncSender.sendMessages(batch).then(\n asyncSender.createMessageBatch(options)\n .handle((ServiceBusMessageBatch newBatch, SynchronousSink<ServiceBusMessageBatch> sink) -> {\n // Expect that the batch we just sent is the current one. If it is not, there's a race\n // condition accessing currentBatch reference.\n if (!currentBatch.compareAndSet(batch, newBatch)) {\n sink.error(new IllegalStateException(\n \"Expected that the object in currentBatch was batch. But it is not.\"));\n } else {\n sink.next(newBatch);\n }\n }));\n } else {\n return Mono.just(batch);\n }\n });\n\n // The sample Flux contains two messages, but it could be an infinite stream of telemetry messages.\n Flux<Void> sendMessagesOperation = telemetryMessages.flatMap(message -> {\n return sendBatchAndGetCurrentBatchOperation.flatMap(batch -> {\n if (batch.tryAddMessage(message)) {\n return Mono.empty();\n } else {\n return sendBatchAndGetCurrentBatchOperation\n .handle((ServiceBusMessageBatch newBatch, SynchronousSink<Void> sink) -> {\n if (!newBatch.tryAddMessage(message)) {\n sink.error(new IllegalArgumentException(\n \"Message is too large to fit in an empty batch.\"));\n } else {\n sink.complete();\n }\n });\n }\n });\n });\n\n // `subscribe` is a non-blocking call. The program will move onto the next line of code when it starts the\n // operation. Users should use the callbacks on `subscribe` to understand the status of the send operation.\n Disposable disposable = sendMessagesOperation.then(sendBatchAndGetCurrentBatchOperation)\n .subscribe(batch -> {\n System.out.println(\"Last batch should be empty: \" + batch.getCount());\n }, error -> {\n System.err.println(\"Error sending telemetry messages: \" + error);\n }, () -> {\n System.out.println(\"Completed.\");\n\n // Continue using the sender and finally, dispose of the sender.\n // Clients should be long-lived objects as they require resources\n // and time to establish a connection to the service.\n asyncSender.close();\n });\n```\n\n**Sample: Sending a message to a session-enabled queue**\n\nThe snippet below demonstrates sending a message to a [Service Bus sessions][] enabled queue. Setting <xref uid=\"com.azure.messaging.servicebus.ServiceBusMessage.setMessageId(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceBusMessage#setMessageId(String)\"></xref> property to \"greetings\" will send the message to a Service Bus session with an id of \"greetings\".\n\n```java\n// 'fullyQualifiedNamespace' will look similar to \"{your-namespace}.servicebus.windows.net\"\n ServiceBusSenderAsyncClient sender = new ServiceBusClientBuilder()\n .credential(fullyQualifiedNamespace, new DefaultAzureCredentialBuilder().build())\n .sender()\n .queueName(sessionEnabledQueueName)\n .buildAsyncClient();\n\n // Setting sessionId publishes that message to a specific session, in this case, \"greeting\".\n ServiceBusMessage message = new ServiceBusMessage(\"Hello world\")\n .setSessionId(\"greetings\");\n\n // `subscribe` is a non-blocking call. The program will move onto the next line of code when it starts the\n // operation. Users should use the callbacks on `subscribe` to understand the status of the send operation.\n sender.sendMessage(message).subscribe(unused -> {\n }, error -> {\n System.err.println(\"Error occurred publishing batch: \" + error);\n }, () -> {\n System.out.println(\"Send complete.\");\n });\n\n // Continue using the sender and finally, dispose of the sender.\n // Clients should be long-lived objects as they require resources\n // and time to establish a connection to the service.\n sender.close();\n```\n\n\n[managed identity]: https://learn.microsoft.com/azure/active-directory/managed-identities-azure-resources/\n[Azure Identity documentation]: https://learn.microsoft.com/java/api/overview/azure/identity-readme\n[Service Bus sessions]: https://learn.microsoft.com/azure/service-bus-messaging/message-sessions"
implements:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html\">AutoCloseable</a>"
metadata: {}
package: "com.azure.messaging.servicebus"
artifact: com.azure:azure-messaging-servicebus:7.17.3