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

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

Go to download

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

There is a newer version: 3.1.0
Show 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 come from a blob. The parameter type can be one of the following:

* *
    *
  • Any native Java types such as int, String, byte[]
  • *
  • Nullable values using Optional<T>
  • *
  • Any POJO type
  • *
* *

The following example is a Java function that uses a queue trigger and an input blob binding. The queue message * contains the name of the blob, and the function logs the size of the blob.

* *
{@literal @}FunctionName("getBlobSize")
 *{@literal @}StorageAccount("AzureWebJobsStorage")
 * public void blobSize(
 *    {@literal @}QueueTrigger(name = "filename",
 *                   queueName = "myqueue-items") String filename,
 *    {@literal @}BlobInput(name = "file",
 *                dataType = "binary",
 *                path = "samples-workitems/{queueTrigger}") byte[] content,
 *     final ExecutionContext context
 * ) {
 *     context.getLogger().info("The size of \"" + filename + "\" is: " + content.length + " bytes");
 * }
* * * @since 1.0.0 */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) public @interface BlobInput { /** * 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:

*
    *
  • "": get the value as a string, and try to deserialize to actual parameter type like POJO
  • *
  • string: always get the value as a string
  • *
  • binary: get the value as a binary data, and try to deserialize to actual parameter type byte[]
  • *
* @return The dataType which will be used by the Functions runtime. */ String dataType() default ""; /** * Defines the path of the blob to which to bind. * @return The blob path string. */ String path(); /** * Defines the app setting name that contains the Azure Storage connection string. * @return The app setting name of the connection string. */ String connection() default ""; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy