azure-docs-sdk-java/docs-ref-autogen/com.microsoft.azure.eventhu...

65 строки
8.6 KiB
YAML

### YamlMime:JavaType
uid: "com.microsoft.azure.eventhubs.BatchOptions"
fullName: "com.microsoft.azure.eventhubs.BatchOptions"
name: "BatchOptions"
nameWithType: "BatchOptions"
summary: "Batch<wbr>Options is used to create <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref>es."
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 **BatchOptions**"
constructors:
- uid: "com.microsoft.azure.eventhubs.BatchOptions.BatchOptions()"
fullName: "com.microsoft.azure.eventhubs.BatchOptions.BatchOptions()"
name: "BatchOptions()"
nameWithType: "BatchOptions.BatchOptions()"
syntax: "public BatchOptions()"
fields:
- uid: "com.microsoft.azure.eventhubs.BatchOptions.maxMessageSize"
fullName: "com.microsoft.azure.eventhubs.BatchOptions.maxMessageSize"
name: "maxMessageSize"
nameWithType: "BatchOptions.maxMessageSize"
summary: "The maximum size in bytes of <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref> being constructed."
field:
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html\">Integer</a>"
syntax: "public Integer maxMessageSize"
desc: "The maximum size in bytes of <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref> being constructed. This value cannot exceed the maximum size supported by Event Hubs service. <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch.tryAdd(com.microsoft.azure.eventhubs.EventData)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch#tryAdd(EventData)\"></xref> API will use this value as the upper limit."
- uid: "com.microsoft.azure.eventhubs.BatchOptions.partitionKey"
fullName: "com.microsoft.azure.eventhubs.BatchOptions.partitionKey"
name: "partitionKey"
nameWithType: "BatchOptions.partitionKey"
summary: "The partition<wbr>Key to use for all <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>s sent in the current <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref>."
field:
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public String partitionKey"
desc: "The partitionKey to use for all <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>s sent in the current <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref>. Setting a PartitionKey will deliver the <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> to a specific Event Hubs partition."
methods:
- uid: "com.microsoft.azure.eventhubs.BatchOptions.with(java.util.function.Consumer<com.microsoft.azure.eventhubs.BatchOptions>)"
fullName: "com.microsoft.azure.eventhubs.BatchOptions.with(Consumer<BatchOptions> builderFunction)"
name: "with(Consumer<BatchOptions> builderFunction)"
nameWithType: "BatchOptions.with(Consumer<BatchOptions> builderFunction)"
parameters:
- name: "builderFunction"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html\">Consumer</a>&lt;<xref href=\"com.microsoft.azure.eventhubs.BatchOptions?alt=com.microsoft.azure.eventhubs.BatchOptions&text=BatchOptions\" data-throw-if-not-resolved=\"False\" />&gt;"
syntax: "public BatchOptions with(Consumer<BatchOptions> builderFunction)"
returns:
type: "<xref href=\"com.microsoft.azure.eventhubs.BatchOptions?alt=com.microsoft.azure.eventhubs.BatchOptions&text=BatchOptions\" data-throw-if-not-resolved=\"False\" />"
type: "class"
desc: "BatchOptions is used to create <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref>es.\n\nIf you're creating <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref>es with <xref uid=\"com.microsoft.azure.eventhubs.EventHubClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventHubClient\"></xref>, then you can set a partitionKey and maxMessageSize using the .with() method. Alternatively, if you'd like the default settings, simply construct BatchOptions with the void constructor. Default settings: - partitionKey is null - maxMessageSize is the maximum allowed size\n\nIf you're creating <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref>es with <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionSender\"></xref>, then you can only set a maxMessageSize using the .with() method. Alternatively, if you'd like the default settings, simply construct BatchOptions with the void constructor. Default settings: - maxMessageSize is the maximum allowed size - Note: if you set a partition key, an <xref uid=\"java.lang.IllegalArgumentException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"IllegalArgumentException\"></xref> will be thrown.\n\nTo construct either type of batch, create a <xref uid=\"com.microsoft.azure.eventhubs.BatchOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BatchOptions\"></xref> object and pass it into the appropriate createBatch method. If using <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionSender\"></xref>, then use (<xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.createBatch(com.microsoft.azure.eventhubs.BatchOptions)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionSender#createBatch(BatchOptions)\"></xref>. If using <xref uid=\"com.microsoft.azure.eventhubs.EventHubClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventHubClient\"></xref>, then use <xref uid=\"com.microsoft.azure.eventhubs.EventHubClient.createBatch(com.microsoft.azure.eventhubs.BatchOptions)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventHubClient#createBatch(BatchOptions)\"></xref>.\n\n```java\n// Note: For all examples, 'client' is an instance of EventHubClient. The usage is the same for PartitionSender,\n however, you can NOT set a partition key when using PartitionSender\n\n // Create EventDataBatch with defaults\n EventDataBatch edb1 = client.createBatch();\n\n // Create EventDataBatch with custom partitionKey\n BatchOptions options = new BatchOptions().with( options -> options.partitionKey = \"foo\");\n EventDataBatch edb2 = client.createBatch(options);\n\n // Create EventDataBatch with custom partitionKey and maxMessageSize\n BatchOptions options = new BatchOptions().with ( options -> {\n options.partitionKey = \"foo\";\n options.maxMessageSize = 100 * 1024;\n };\n EventDataBatch edb3 = client.createBatch(options);\n```"
metadata: {}
package: "com.microsoft.azure.eventhubs"
artifact: com.microsoft.azure:azure-eventhubs:3.2.2