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

168 строки
18 KiB
YAML

### YamlMime:JavaType
uid: "com.microsoft.azure.eventhubs.PartitionSender"
fullName: "com.microsoft.azure.eventhubs.PartitionSender"
name: "PartitionSender"
nameWithType: "PartitionSender"
summary: "This sender class is a logical representation of sending events to a specific Event<wbr>Hub partition."
syntax: "public interface **PartitionSender**"
methods:
- uid: "com.microsoft.azure.eventhubs.PartitionSender.close()"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.close()"
name: "close()"
nameWithType: "PartitionSender.close()"
modifiers:
- "abstract"
syntax: "public abstract CompletableFuture<Void> close()"
returns:
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html\">CompletableFuture</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.microsoft.azure.eventhubs.PartitionSender.closeSync()"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.closeSync()"
name: "closeSync()"
nameWithType: "PartitionSender.closeSync()"
modifiers:
- "abstract"
syntax: "public abstract void closeSync()"
exceptions:
- type: "<xref href=\"com.microsoft.azure.eventhubs.EventHubException?alt=com.microsoft.azure.eventhubs.EventHubException&text=EventHubException\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.eventhubs.PartitionSender.createBatch()"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.createBatch()"
name: "createBatch()"
nameWithType: "PartitionSender.createBatch()"
summary: "Creates an Empty Collection of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>."
modifiers:
- "default"
syntax: "public default EventDataBatch createBatch()"
desc: "Creates an Empty Collection of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>. The same partitionKey must be used while sending these events using <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventDataBatch)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionSender#send(EventDataBatch)\"></xref>."
returns:
description: "the empty <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref>, after negotiating maximum message size with EventHubs service"
type: "<xref href=\"com.microsoft.azure.eventhubs.EventDataBatch?alt=com.microsoft.azure.eventhubs.EventDataBatch&text=EventDataBatch\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.eventhubs.PartitionSender.createBatch(com.microsoft.azure.eventhubs.BatchOptions)"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.createBatch(BatchOptions options)"
name: "createBatch(BatchOptions options)"
nameWithType: "PartitionSender.createBatch(BatchOptions options)"
summary: "Creates an Empty Collection of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>."
modifiers:
- "abstract"
parameters:
- description: "see <xref uid=\"com.microsoft.azure.eventhubs.BatchOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BatchOptions\"></xref> for more usage details"
name: "options"
type: "<xref href=\"com.microsoft.azure.eventhubs.BatchOptions?alt=com.microsoft.azure.eventhubs.BatchOptions&text=BatchOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public abstract EventDataBatch createBatch(BatchOptions options)"
desc: "Creates an Empty Collection of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>. The same partitionKey must be used while sending these events using <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventDataBatch)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionSender#send(EventDataBatch)\"></xref>."
returns:
description: "the empty <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref>, after negotiating maximum message size with EventHubs service"
type: "<xref href=\"com.microsoft.azure.eventhubs.EventDataBatch?alt=com.microsoft.azure.eventhubs.EventDataBatch&text=EventDataBatch\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.eventhubs.PartitionSender.getPartitionId()"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.getPartitionId()"
name: "getPartitionId()"
nameWithType: "PartitionSender.getPartitionId()"
summary: "The partition id that will receive events from this sender."
modifiers:
- "abstract"
syntax: "public abstract String getPartitionId()"
desc: "The partition id that will receive events from this sender."
returns:
description: "the partition id the PartitionSender is connected to."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventData)"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.send(EventData data)"
name: "send(EventData data)"
nameWithType: "PartitionSender.send(EventData data)"
summary: "Send <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> to a specific Event<wbr>Hub partition."
modifiers:
- "abstract"
parameters:
- description: "the <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> to be sent."
name: "data"
type: "<xref href=\"com.microsoft.azure.eventhubs.EventData?alt=com.microsoft.azure.eventhubs.EventData&text=EventData\" data-throw-if-not-resolved=\"False\" />"
syntax: "public abstract CompletableFuture<Void> send(EventData data)"
desc: "Send <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> to a specific EventHub partition. The target partition is pre-determined when this PartitionSender was created. This send pattern emphasize data correlation over general availability and latency.\n\nThere are 3 ways to send to EventHubs, each exposed as a method (along with its sendBatch overload):\n\n```java\ni. , , \n ii. or \n iii. , , or\n```\n\nUse this type of Send, if:\n\n```java\ni. The client wants to take direct control of distribution of data across partitions. In this case client is responsible for making sure there is at least one sender per event hub partition.\n ii. User cannot use partition key as a mean to direct events to specific partition, yet there is a need for data correlation with partitioning scheme.\n```"
returns:
description: "a CompletableFuture that can be completed when the send operations is done.."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html\">CompletableFuture</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventDataBatch)"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.send(EventDataBatch eventDatas)"
name: "send(EventDataBatch eventDatas)"
nameWithType: "PartitionSender.send(EventDataBatch eventDatas)"
summary: "Send <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref> to a specific Event<wbr>Hub partition."
modifiers:
- "abstract"
parameters:
- description: "EventDataBatch to send to EventHub"
name: "eventDatas"
type: "<xref href=\"com.microsoft.azure.eventhubs.EventDataBatch?alt=com.microsoft.azure.eventhubs.EventDataBatch&text=EventDataBatch\" data-throw-if-not-resolved=\"False\" />"
syntax: "public abstract CompletableFuture<Void> send(EventDataBatch eventDatas)"
desc: "Send <xref uid=\"com.microsoft.azure.eventhubs.EventDataBatch\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventDataBatch\"></xref> to a specific EventHub partition. The targeted partition is pre-determined when this PartitionSender was created. A partitionKey cannot be set when using EventDataBatch with a PartitionSender.\n\nThere are 3 ways to send to EventHubs, to understand this particular type of Send refer to the overload <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventData)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#send(EventData)\"></xref>, which is the same type of Send and is used to send single <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>.\n\nSending a batch of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>'s is useful in the following cases:\n\n```java\ni. Efficient send - sending a batch of maximizes the overall throughput by optimally using the number of sessions created to EventHubs' service.\n ii. Send multiple 's in a Transaction. To achieve ACID properties, the Gateway Service will forward all 's in the batch to a single EventHubs' partition.\n```"
returns:
description: "a CompletableFuture that can be completed when the send operation is done.."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html\">CompletableFuture</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.microsoft.azure.eventhubs.PartitionSender.send(java.lang.Iterable<com.microsoft.azure.eventhubs.EventData>)"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.send(Iterable<EventData> eventDatas)"
name: "send(Iterable<EventData> eventDatas)"
nameWithType: "PartitionSender.send(Iterable<EventData> eventDatas)"
summary: "Send <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> to a specific Event<wbr>Hub partition."
modifiers:
- "abstract"
parameters:
- description: "batch of events to send to EventHub"
name: "eventDatas"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<xref href=\"com.microsoft.azure.eventhubs.EventData?alt=com.microsoft.azure.eventhubs.EventData&text=EventData\" data-throw-if-not-resolved=\"False\" />&gt;"
syntax: "public abstract CompletableFuture<Void> send(Iterable<EventData> eventDatas)"
desc: "Send <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> to a specific EventHub partition. The targeted partition is pre-determined when this PartitionSender was created.\n\nThere are 3 ways to send to EventHubs, to understand this particular type of Send refer to the overload <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventData)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#send(EventData)\"></xref>, which is the same type of Send and is used to send single <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>.\n\nSending a batch of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>'s is useful in the following cases:\n\n```java\ni. Efficient send - sending a batch of maximizes the overall throughput by optimally using the number of sessions created to EventHubs' service.\n ii. Send multiple 's in a Transaction. To achieve ACID properties, the Gateway Service will forward all 's in the batch to a single EventHubs' partition.\n```\n\nSample code (sample uses sync version of the api but concept are identical):\n\n```java\nGson gson = new GsonBuilder().create();\n EventHubClient client = EventHubClient.createSync(\"__connection__\");\n PartitionSender senderToPartitionOne = client.createPartitionSenderSync(\"1\");\n\n while (true)\n {\n LinkedList events = new LinkedList();\n for (int count = 1; count < 11; count++)\n {\n PayloadEvent payload = new PayloadEvent(count);\n byte[] payloadBytes = gson.toJson(payload).getBytes(Charset.defaultCharset());\n EventData sendEvent = EventData.create(payloadBytes);\n sendEvent.getProperties().put(\"from\", \"javaClient\");\n events.add(sendEvent);\n }\n\n senderToPartitionOne.sendSync(events);\n System.out.println(String.format(\"Sent Batch... Size: %s\", events.size()));\n }\n```"
returns:
description: "a CompletableFuture that can be completed when the send operations is done.."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html\">CompletableFuture</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.microsoft.azure.eventhubs.PartitionSender.sendSync(com.microsoft.azure.eventhubs.EventData)"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.sendSync(EventData data)"
name: "sendSync(EventData data)"
nameWithType: "PartitionSender.sendSync(EventData data)"
summary: "Synchronous version of <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventData)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#send(EventData)\"></xref> Api."
modifiers:
- "default"
parameters:
- description: "the <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> to be sent."
name: "data"
type: "<xref href=\"com.microsoft.azure.eventhubs.EventData?alt=com.microsoft.azure.eventhubs.EventData&text=EventData\" data-throw-if-not-resolved=\"False\" />"
syntax: "public default void sendSync(EventData data)"
exceptions:
- description: "if the total size of the <xref uid=\"EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> exceeds a pre-defined limit set by the service. Default is 256k bytes."
type: "<xref href=\"com.microsoft.azure.eventhubs.EventHubException?alt=com.microsoft.azure.eventhubs.EventHubException&text=EventHubException\" data-throw-if-not-resolved=\"False\" />"
desc: "Synchronous version of <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventData)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#send(EventData)\"></xref> Api."
- uid: "com.microsoft.azure.eventhubs.PartitionSender.sendSync(com.microsoft.azure.eventhubs.EventDataBatch)"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.sendSync(EventDataBatch eventDatas)"
name: "sendSync(EventDataBatch eventDatas)"
nameWithType: "PartitionSender.sendSync(EventDataBatch eventDatas)"
summary: "Synchronous version of <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventDataBatch)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#send(EventDataBatch)\"></xref>"
modifiers:
- "default"
parameters:
- description: "EventDataBatch to send to EventHub"
name: "eventDatas"
type: "<xref href=\"com.microsoft.azure.eventhubs.EventDataBatch?alt=com.microsoft.azure.eventhubs.EventDataBatch&text=EventDataBatch\" data-throw-if-not-resolved=\"False\" />"
syntax: "public default void sendSync(EventDataBatch eventDatas)"
exceptions:
- description: "if Service Bus service encountered problems during the operation."
type: "<xref href=\"com.microsoft.azure.eventhubs.EventHubException?alt=com.microsoft.azure.eventhubs.EventHubException&text=EventHubException\" data-throw-if-not-resolved=\"False\" />"
desc: "Synchronous version of <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(com.microsoft.azure.eventhubs.EventDataBatch)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#send(EventDataBatch)\"></xref>"
- uid: "com.microsoft.azure.eventhubs.PartitionSender.sendSync(java.lang.Iterable<com.microsoft.azure.eventhubs.EventData>)"
fullName: "com.microsoft.azure.eventhubs.PartitionSender.sendSync(Iterable<EventData> eventDatas)"
name: "sendSync(Iterable<EventData> eventDatas)"
nameWithType: "PartitionSender.sendSync(Iterable<EventData> eventDatas)"
summary: "Synchronous version of <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(java.lang.Iterable<com.microsoft.azure.eventhubs.EventData>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#send(Iterable)\"></xref> ."
modifiers:
- "default"
parameters:
- description: "batch of events to send to EventHub"
name: "eventDatas"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<xref href=\"com.microsoft.azure.eventhubs.EventData?alt=com.microsoft.azure.eventhubs.EventData&text=EventData\" data-throw-if-not-resolved=\"False\" />&gt;"
syntax: "public default void sendSync(Iterable<EventData> eventDatas)"
exceptions:
- description: "if Service Bus service encountered problems during the operation."
type: "<xref href=\"com.microsoft.azure.eventhubs.EventHubException?alt=com.microsoft.azure.eventhubs.EventHubException&text=EventHubException\" data-throw-if-not-resolved=\"False\" />"
desc: "Synchronous version of <xref uid=\"com.microsoft.azure.eventhubs.PartitionSender.send(java.lang.Iterable<com.microsoft.azure.eventhubs.EventData>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#send(Iterable)\"></xref> ."
type: "interface"
desc: "This sender class is a logical representation of sending events to a specific EventHub partition. Do not use this class if you do not care about sending events to specific partitions. Instead, use <xref uid=\"com.microsoft.azure.eventhubs.EventHubClient.send*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventHubClient#send\"></xref> method."
metadata: {}
package: "com.microsoft.azure.eventhubs"
artifact: com.microsoft.azure:azure-eventhubs:3.2.2