All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.azure.functions.annotation.EventHubOutput Maven / Gradle / Ivy

Go to download

This package contains all Java interfaces and annotations to interact with Microsoft Azure functions runtime.

The newest version!
/**
 * 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;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 

Place this on a parameter whose value would be published to the event hub. * The parameter type should be OutputBinding<T>, where T could be one of:

* *
    *
  • Any native Java types such as int, String, byte[]
  • *
  • Any POJO type
  • *
* *

The following example shows a Java function that writes a message to an event hub:

* *
{@literal @}FunctionName("sendTime")
 *{@literal @}EventHubOutput(name = "event", eventHubName = "samples-workitems", connection = "AzureEventHubConnection")
 * public String sendTime(
 *    {@literal @}TimerTrigger(name = "sendTimeTrigger", schedule = "0 */5 * * * *") String timerInfo
 * ) {
 *     return LocalDateTime.now().toString();
 * }
* * @since 1.0.0 */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface EventHubOutput { /** * The variable name used in function.json. * @return The variable name used in function.json. */ String name(); /** *

Defines how Functions runtime should treat the parameter value. Possible values are:

*
    *
  • "" or string: treat it as a string whose value is serialized from the parameter
  • *
  • binary: treat it as a binary data whose value comes from for example OutputBinding<byte[]>
  • *
* @return The dataType which will be used by the Functions runtime. */ String dataType() default ""; /** * Defines the name of the event hub to which to publish. * @return The event hub name string. */ String eventHubName(); /** * Defines the app setting name that contains the Azure Eventhub connection string. * @return The app setting name of the connection string. */ String connection(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy