com.microsoft.azure.functions.annotation

Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ライセンス情報については、プロジェクト ルートの「License.txt」を参照してください。 Azure Functions用 Java API の一部として使用するための注釈とサポート クラス。

クラス

BindingTest

Functions の注釈コントラクトと規則を適用する単体テスト

インターフェイス

BindingName

これは、値がランタイムから取得されるパラメーター Azure Functions配置します。 この注釈は、トリガー メタデータの値を取得する場合、または function.json で独自のバインドを手動で定義する場合に使用します。

BlobInput

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"); }

BlobOutput

BlobInput(name = "source", path = "samples-workitems/{queueTrigger}") String content ) { return content; }

BlobTrigger

BindingName("name") String filename, final ExecutionContext context ) { context.getLogger().info("Name: " + filename + ", Size: " + content.length + "bytes"); }

CosmosDBInput

CosmosDBInput(name = "database", databaseName = "ToDoList", collectionName = "Items", id = "{Query.id}", connectionStringSetting = "AzureCosmosDBConnection") Optional<String> item ) { return item.orElse("Not found")); }

CosmosDBOutput

CosmosDBOutput(name = "database", databaseName = "ToDoList", collectionName = "Items", connectionStringSetting = "AzureCosmosDBConnection") ) { return "{ \"id": "" + System.currentTimeMillis() + "", "description": "" + message + "" }"; }

CosmosDBTrigger

CosmosDBTrigger(name = "database", databaseName = "ToDoList", collectionName = "Items", leaseCollectionName = "leases", createLeaseCollectionIfNotExists = true, connectionStringSetting = "AzureCosmosDBConnection") List<Map<String, String>> items, final ExecutionContext context ) { context.getLogger().info(items.size() + " item(s) is/are inserted."); if (!items.isEmpty()) { context.getLogger().info("The ID of the first item is: " + items.get(0).get("id")); } }

CustomBinding

CustomBinding(direction = "in", name = "inputParameterName", type = "customBindingTrigger") String customTriggerInput final ExecutionContext context ) { context.getLogger().info(customTriggerInput); }

EventGridOutput

EventGridOutput(name = "outputEvent", topicEndpointUri = "MyEventGridTopicUriSetting", topicKeySetting = "MyEventGridTopicKeySetting") OutputBinding<String> outputEvent final ExecutionContext context ) { context.getLogger().info(content); final String eventGridOutputDocument = "{\"id": "100", "eventType":"recordInserted", "subject": "myapp/test/java", "eventTime":"2017-08-10T21:03:07+00:00", "data": {"tag1": "value1","tag2":"value2"}, "dataVersion": "1.0"}"; outputEvent.setValue(eventGridOutputDocument);}

EventGridTrigger

EventGridTrigger(name = "event") String content, final ExecutionContext context ) { context.getLogger().info(content); }

EventHubOutput

TimerTrigger(name = "sendTimeTrigger", schedule = "0 *&#47;5 * * * *") String timerInfo ) { return LocalDateTime.now().toString(); }

EventHubTrigger

EventHubTrigger(name = "event", eventHubName = "samples-workitems", connection = "AzureEventHubConnection") String message, final ExecutionContext context ) { context.getLogger().info("Event hub message received: " + message); }

ExponentialBackoffRetry

指数バックオフ再試行戦略を定義します。再試行間の遅延が徐々に大きくなり、指定された最大/分によって制限されます。

FixedDelayRetry

再試行の間に固定遅延が使用される再試行戦略を定義します。

FunctionName

HttpTrigger(name = "req", methods = {"get"}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request) { .... }

HttpOutput

これは、HTTP 応答としてユーザーに返される値を持つパラメーターに配置します。 パラメーターの型は OutputBinding<T> である必要があります。T は次のいずれかになります。

    <li>
    
      <p>
    
        <xref uid="com.microsoft.azure.functions.HttpResponseMessage" data-throw-if-not-resolved="false" data-raw-source="HttpResponseMessage"></xref>
    
      </p>
    
    </li>
    
    <li>
    
      <p>Any native Java types such as int, String, byte[] </p>
    
    </li>
    
    <li>
    
      <p>Any POJO type </p>
    
    </li>
    

HttpTrigger

HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) final HttpRequestMessage<Optional<String>> request) { String name = request.getBody().orElseGet(() -> request.getQueryParameters().get("name")); return name == null ? "クエリ文字列または要求本文で名前を渡してください" : "Hello " + name; }

KafkaOutput

KafkaOutput(name = "event", topic = "users", brokerList="broker:29092") OutputBinding<String<output, final ExecutionContext context) { context.getLogger().info("Message:" + message);output.setValue(message);return "{ \"id": "" + System.currentTimeMillis() + "", "description": "" + message + "" }"; }

KafkaTrigger

KafkaTrigger(name = "kafkaTrigger", topic = "users", brokerList="broker:29092", consumerGroup="functions") List<Map<String, String>> kafkaEventData, final ExecutionContext context ) { context.getLogger().info(kafkaEventData); }

QueueOutput

HttpOutput(name = "response") final OutputBinding<String> result ) { result.setValue(message + " has added."); return message; }

QueueTrigger

QueueTrigger(name = "msg", queueName = "myqueue-items", connection = "AzureWebJobsStorage") String message, final ExecutionContext context ) { context.getLogger().info("Queue message processed: " + message); }

SendGridOutput

この値を SendGrid に書き込むパラメーターに配置します。 パラメーターの型は OutputBinding<T> である必要があります。T は次のいずれかになります。

    <li>
    
      <p>Any native Java types such as int, String, byte[] </p>
    
    </li>
    
    <li>
    
      <p>Any POJO type </p>
    
    </li>
    

ServiceBusQueueOutput

HttpOutput(name = "response") final OutputBinding<String> result ) { result.setValue(message + " has sent."); return message; }

ServiceBusQueueTrigger

ServiceBusQueueTrigger(name = "msg", queueName = "myqueue", connection = "AzureServiceBusConnection") final String message, final ExecutionContext context ) { context.getLogger().info("Message is received: " + message); }

ServiceBusTopicOutput

これは、値が Service Bus トピックに書き込まれるパラメーターに配置します。 パラメーターの型は OutputBinding<T> である必要があります。T は次のいずれかになります。

    <li>
    
      <p>Any native Java types such as int, String, byte[] </p>
    
    </li>
    
    <li>
    
      <p>Any POJO type </p>
    
    </li>
    

ServiceBusTopicTrigger

ServiceBusTopicTrigger(name = "msg", topicName = "mytopicname", subscriptionName = "mysubname", connection = "myconnvarname") String message, final ExecutionContext context ) { context.getLogger().info(message); }

StorageAccount

Azure Storage 接続文字列の同じアプリ設定名を共有する、そのメソッドに複数の Azure Storage トリガー/入力/出力がある場合は、この注釈をメソッドに適用します。

TableInput

TableInput(name = "items", tableName = "mytablename", partitionKey = "myparkey", connection = "myconnvarname") MyItem[] items ) { return items.length; }

TableOutput

これは、値がストレージ テーブルに書き込まれるパラメーターに配置します。 パラメーターの型は OutputBinding<T> である必要があります。T は次のいずれかになります。

    <li>
    
      <p>Any native Java types such as int, String, byte[] </p>
    
    </li>
    
    <li>
    
      <p>Any POJO type </p>
    
    </li>
    

TimerTrigger

TimerTrigger(name = "keepAliveTrigger", schedule = "0 *&#47;5 * * * *") String timerInfo, ExecutionContext context ) { // timeInfo は JSON 文字列です。お気に入りの JSON ライブラリ コンテキスト getLogger().info("Timer is triggered: " + timerInfo); }

TwilioSmsOutput

これは、twilio SMS を介して値が送信されるパラメーターに配置します。 パラメーターの型は OutputBinding<T> である必要があります。T は次のいずれかになります。

    <li>
    
      <p>Any native Java types such as int, String, byte[] </p>
    
    </li>
    
    <li>
    
      <p>Any POJO type </p>
    
    </li>
    

列挙型

AccessRights

Azure Service Busアクセス許可。

AuthorizationLevel

Azure HTTP 承認レベル: 関数を呼び出すために要求に存在する必要があるキー (存在する場合) を決定します。

Cardinality

EventHubTrigger 入力のカーディナリティ。 入力が 1 つのメッセージの場合は 'ONE' を選択し、入力がメッセージの配列である場合は "多" を選択します。 指定されていない場合、'多' が既定値です