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

226 строки
20 KiB
YAML

### YamlMime:JavaType
uid: "com.microsoft.azure.eventhubs.PartitionReceiver"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver"
name: "PartitionReceiver"
nameWithType: "PartitionReceiver"
summary: "This is a logical representation of receiving from a Event<wbr>Hub partition."
syntax: "public interface **PartitionReceiver**"
fields:
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.DEFAULT_PREFETCH_COUNT"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.DEFAULT_PREFETCH_COUNT"
name: "DEFAULT_PREFETCH_COUNT"
nameWithType: "PartitionReceiver.DEFAULT_PREFETCH_COUNT"
modifiers:
- "static"
- "final"
field:
value: "500"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public static final int DEFAULT_PREFETCH_COUNT"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.MAXIMUM_PREFETCH_COUNT"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.MAXIMUM_PREFETCH_COUNT"
name: "MAXIMUM_PREFETCH_COUNT"
nameWithType: "PartitionReceiver.MAXIMUM_PREFETCH_COUNT"
modifiers:
- "static"
- "final"
field:
value: "8000"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public static final int MAXIMUM_PREFETCH_COUNT"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.MINIMUM_PREFETCH_COUNT"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.MINIMUM_PREFETCH_COUNT"
name: "MINIMUM_PREFETCH_COUNT"
nameWithType: "PartitionReceiver.MINIMUM_PREFETCH_COUNT"
modifiers:
- "static"
- "final"
field:
value: "1"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public static final int MINIMUM_PREFETCH_COUNT"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.NULL_EPOCH"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.NULL_EPOCH"
name: "NULL_EPOCH"
nameWithType: "PartitionReceiver.NULL_EPOCH"
modifiers:
- "static"
- "final"
field:
value: "0"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public static final long NULL_EPOCH"
methods:
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.close()"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.close()"
name: "close()"
nameWithType: "PartitionReceiver.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.PartitionReceiver.closeSync()"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.closeSync()"
name: "closeSync()"
nameWithType: "PartitionReceiver.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.PartitionReceiver.getEpoch()"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.getEpoch()"
name: "getEpoch()"
nameWithType: "PartitionReceiver.getEpoch()"
summary: "Get the epoch value that this receiver is currently using for partition ownership."
modifiers:
- "abstract"
syntax: "public abstract long getEpoch()"
desc: "Get the epoch value that this receiver is currently using for partition ownership.\n\nA value of 0 means this receiver is not an epoch-based receiver."
returns:
description: "the epoch value that this receiver is currently using for partition ownership."
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.getEventPosition()"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.getEventPosition()"
name: "getEventPosition()"
nameWithType: "PartitionReceiver.getEventPosition()"
summary: "Get the <xref uid=\"com.microsoft.azure.eventhubs.EventPosition\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventPosition\"></xref> that corresponds to an <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> which was returned last by the receiver."
modifiers:
- "abstract"
syntax: "public abstract EventPosition getEventPosition()"
desc: "Get the <xref uid=\"com.microsoft.azure.eventhubs.EventPosition\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventPosition\"></xref> that corresponds to an <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> which was returned last by the receiver.\n\nThis value will not be populated, unless the knob <xref uid=\"com.microsoft.azure.eventhubs.ReceiverOptions.setReceiverRuntimeMetricEnabled(boolean)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ReceiverOptions#setReceiverRuntimeMetricEnabled(boolean)\"></xref> is set. Note that EventPosition object is initialized using SequenceNumber and other parameters are not set and get will return null."
returns:
description: "the EventPosition object."
type: "<xref href=\"com.microsoft.azure.eventhubs.EventPosition?alt=com.microsoft.azure.eventhubs.EventPosition&text=EventPosition\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.getIsOpen()"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.getIsOpen()"
name: "getIsOpen()"
nameWithType: "PartitionReceiver.getIsOpen()"
summary: "Determine the current state of the receiver."
modifiers:
- "abstract"
syntax: "public abstract boolean getIsOpen()"
desc: "Determine the current state of the receiver."
returns:
description: "false if the receiver is closing or has been closed, true if the receiver is open and ready to use."
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.getPartitionId()"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.getPartitionId()"
name: "getPartitionId()"
nameWithType: "PartitionReceiver.getPartitionId()"
summary: "Get Event<wbr>Hubs partition identifier."
modifiers:
- "abstract"
syntax: "public abstract String getPartitionId()"
desc: "Get EventHubs partition identifier."
returns:
description: "The identifier representing the partition from which this receiver is fetching data"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.getReceiveTimeout()"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.getReceiveTimeout()"
name: "getReceiveTimeout()"
nameWithType: "PartitionReceiver.getReceiveTimeout()"
modifiers:
- "abstract"
syntax: "public abstract Duration getReceiveTimeout()"
returns:
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html\">Duration</a>"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.getRuntimeInformation()"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.getRuntimeInformation()"
name: "getRuntimeInformation()"
nameWithType: "PartitionReceiver.getRuntimeInformation()"
summary: "Gets the temporal <xref uid=\"com.microsoft.azure.eventhubs.ReceiverRuntimeInformation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ReceiverRuntimeInformation\"></xref> for this Event<wbr>Hub partition."
modifiers:
- "abstract"
syntax: "public abstract ReceiverRuntimeInformation getRuntimeInformation()"
desc: "Gets the temporal <xref uid=\"com.microsoft.azure.eventhubs.ReceiverRuntimeInformation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ReceiverRuntimeInformation\"></xref> for this EventHub partition. In general, this information is a representation of, where this <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiver\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiver\"></xref>'s end of stream is, at the time <xref uid=\"com.microsoft.azure.eventhubs.ReceiverRuntimeInformation.getRetrievalTime()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ReceiverRuntimeInformation#getRetrievalTime()\"></xref>.\n\nThis value will not be populated, unless the knob <xref uid=\"com.microsoft.azure.eventhubs.ReceiverOptions.setReceiverRuntimeMetricEnabled(boolean)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ReceiverOptions#setReceiverRuntimeMetricEnabled(boolean)\"></xref> is set. This value will be refreshed every time an <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> is consumed from <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiver\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiver\"></xref>. For ex: if no events have been consumed, then this value is not populated."
returns:
description: "receiver runtime information"
type: "<xref href=\"com.microsoft.azure.eventhubs.ReceiverRuntimeInformation?alt=com.microsoft.azure.eventhubs.ReceiverRuntimeInformation&text=ReceiverRuntimeInformation\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.receive(int)"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.receive(int maxEventCount)"
name: "receive(int maxEventCount)"
nameWithType: "PartitionReceiver.receive(int maxEventCount)"
summary: "Receive a batch of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>'s from an Event<wbr>Hub partition"
modifiers:
- "abstract"
parameters:
- description: "maximum number of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>'s that this call should return"
name: "maxEventCount"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public abstract CompletableFuture<Iterable<EventData>> receive(int maxEventCount)"
desc: "Receive a batch of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>'s from an EventHub partition\n\nSample code (sample uses sync version of the api but concept are identical):\n\n```java\nEventHubClient client = EventHubClient.createSync(\"__connection__\");\n PartitionReceiver receiver = client.createPartitionReceiverSync(\"ConsumerGroup1\", \"1\");\n Iterable receivedEvents = receiver.receiveSync();\n\n while (true)\n {\n int batchSize = 0;\n if (receivedEvents != null)\n {\n for(EventData receivedEvent: receivedEvents)\n {\n System.out.println(String.format(\"Message Payload: %s\", new String(receivedEvent.getBytes(), Charset.defaultCharset())));\n System.out.println(String.format(\"Offset: %s, SeqNo: %s, EnqueueTime: %s\",\n receivedEvent.getSystemProperties().getOffset(),\n receivedEvent.getSystemProperties().getSequenceNumber(),\n receivedEvent.getSystemProperties().getEnqueuedTime()));\n batchSize++;\n }\n }\n\n System.out.println(String.format(\"ReceivedBatch Size: %s\", batchSize));\n receivedEvents = receiver.receiveSync();\n }\n```"
returns:
description: "A completableFuture that will yield a batch of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>'s from the partition on which this receiver is created. Returns 'null' if no <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> is present."
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/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;&gt;"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.receiveSync(int)"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.receiveSync(int maxEventCount)"
name: "receiveSync(int maxEventCount)"
nameWithType: "PartitionReceiver.receiveSync(int maxEventCount)"
summary: "Synchronous version of <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiver.receive*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#receive\"></xref>."
modifiers:
- "default"
parameters:
- description: "maximum number of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>'s that this call should return"
name: "maxEventCount"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public default Iterable<EventData> receiveSync(int maxEventCount)"
exceptions:
- description: "if ServiceBus client encountered any unrecoverable/non-transient problems during <xref uid=\"#receive\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#receive\"></xref>"
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.PartitionReceiver.receive*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#receive\"></xref>."
returns:
description: "Batch of <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref>'s from the partition on which this receiver is created. Returns 'null' if no <xref uid=\"com.microsoft.azure.eventhubs.EventData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EventData\"></xref> is present."
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;"
- uid: "com.microsoft.azure.eventhubs.PartitionReceiver.setReceiveHandler(com.microsoft.azure.eventhubs.PartitionReceiveHandler)"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.setReceiveHandler(PartitionReceiveHandler receiveHandler)"
name: "setReceiveHandler(PartitionReceiveHandler receiveHandler)"
nameWithType: "PartitionReceiver.setReceiveHandler(PartitionReceiveHandler receiveHandler)"
summary: "Register a receive handler that will be called when an event is available."
modifiers:
- "abstract"
parameters:
- description: "An implementation of <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiveHandler\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiveHandler\"></xref>. Setting this handler to <code>null</code> will stop the receive pump."
name: "receiveHandler"
type: "<xref href=\"com.microsoft.azure.eventhubs.PartitionReceiveHandler?alt=com.microsoft.azure.eventhubs.PartitionReceiveHandler&text=PartitionReceiveHandler\" data-throw-if-not-resolved=\"False\" />"
syntax: "public abstract CompletableFuture<Void> setReceiveHandler(PartitionReceiveHandler receiveHandler)"
desc: "Register a receive handler that will be called when an event is available. A <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiveHandler\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiveHandler\"></xref> is a handler that allows user to specify a callback for event processing and error handling in a receive pump model."
returns:
description: "A completableFuture which sets receiveHandler"
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.PartitionReceiver.setReceiveHandler(com.microsoft.azure.eventhubs.PartitionReceiveHandler,boolean)"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.setReceiveHandler(PartitionReceiveHandler receiveHandler, boolean invokeWhenNoEvents)"
name: "setReceiveHandler(PartitionReceiveHandler receiveHandler, boolean invokeWhenNoEvents)"
nameWithType: "PartitionReceiver.setReceiveHandler(PartitionReceiveHandler receiveHandler, boolean invokeWhenNoEvents)"
summary: "Register a receive handler that will be called when an event is available."
modifiers:
- "abstract"
parameters:
- description: "An implementation of <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiveHandler\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiveHandler\"></xref>"
name: "receiveHandler"
type: "<xref href=\"com.microsoft.azure.eventhubs.PartitionReceiveHandler?alt=com.microsoft.azure.eventhubs.PartitionReceiveHandler&text=PartitionReceiveHandler\" data-throw-if-not-resolved=\"False\" />"
- description: "flag to indicate whether the <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiveHandler.onReceive(java.lang.Iterable<com.microsoft.azure.eventhubs.EventData>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiveHandler#onReceive(Iterable)\"></xref> should be invoked when the receive call times out"
name: "invokeWhenNoEvents"
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
syntax: "public abstract CompletableFuture<Void> setReceiveHandler(PartitionReceiveHandler receiveHandler, boolean invokeWhenNoEvents)"
desc: "Register a receive handler that will be called when an event is available. A <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiveHandler\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiveHandler\"></xref> is a handler that allows user to specify a callback for event processing and error handling in a receive pump model."
returns:
description: "A completableFuture which sets receiveHandler"
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.PartitionReceiver.setReceiveTimeout(java.time.Duration)"
fullName: "com.microsoft.azure.eventhubs.PartitionReceiver.setReceiveTimeout(Duration value)"
name: "setReceiveTimeout(Duration value)"
nameWithType: "PartitionReceiver.setReceiveTimeout(Duration value)"
modifiers:
- "abstract"
parameters:
- name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html\">Duration</a>"
syntax: "public abstract void setReceiveTimeout(Duration value)"
type: "interface"
desc: "This is a logical representation of receiving from a EventHub partition.\n\nA <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiver\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiver\"></xref> is tied to a ConsumerGroup + EventHub Partition combination.\n\n * If an epoch based <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiver\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiver\"></xref> (i.e., PartitionReceiver.getEpoch != 0) is created, EventHubs service will guarantee only 1 active receiver exists per ConsumerGroup + Partition combo. This is the recommended approach to create a <xref uid=\"com.microsoft.azure.eventhubs.PartitionReceiver\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PartitionReceiver\"></xref>.\n * Multiple receivers per ConsumerGroup + Partition combo can be created using non-epoch receivers."
metadata: {}
package: "com.microsoft.azure.eventhubs"
artifact: com.microsoft.azure:azure-eventhubs:3.2.2