diff --git a/src/main/java/com/microsoft/azure/functions/annotation/Cardinality.java b/src/main/java/com/microsoft/azure/functions/annotation/Cardinality.java new file mode 100644 index 0000000..ea7535a --- /dev/null +++ b/src/main/java/com/microsoft/azure/functions/annotation/Cardinality.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.functions.annotation; + +/** + *

Cardinality of the EventHubTrigger input. Choose 'ONE' if the input is a single message or 'Many' if the input is an array of messages. 'Many' is the default if unspecified

+ * + * @since 1.0.0 + */ +public enum Cardinality { + /** + * To receive a single message, set cardinality to ONE + */ + ONE, + + /** + * To receive events in a batch, set cardinality to MANY. This is the default if omitted. + */ + MANY +} diff --git a/src/main/java/com/microsoft/azure/functions/annotation/EventHubTrigger.java b/src/main/java/com/microsoft/azure/functions/annotation/EventHubTrigger.java index 7773bb9..bf2142b 100644 --- a/src/main/java/com/microsoft/azure/functions/annotation/EventHubTrigger.java +++ b/src/main/java/com/microsoft/azure/functions/annotation/EventHubTrigger.java @@ -59,6 +59,13 @@ public @interface EventHubTrigger { */ String eventHubName(); + /** + * Cardinality of the trigger input. Choose 'One' if the input is a single message or 'Many' if the input is an array of messages. 'Many' is the default if unspecified + * @return An {@link Cardinality} value representing the Cardinality + */ + Cardinality cardinality() default Cardinality.MANY; + + /** * Defines the consumer group of the event hub to which to bind. * @return The event hub consumer group string.