@Retention(value=RUNTIME) @Target(value={PARAMETER,METHOD}) public @interface EventGridOutput
Place this on a parameter whose value would come from EventGrid, and causing the method to run when an event is arrived. The parameter type can be one of the following:
The following example shows a Java function that prints out an event and then sends an event to a custom eventGrid topic:
@FunctionName("eventGridMonitor")
public void logEvent(
@EventGridTrigger(name = "event") String content,
@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);
}| Modifier and Type | Required Element and Description |
|---|---|
String |
name
The variable name used in function.json.
|
String |
topicEndpointUri
Gets or sets the topic events endpoint URI.
|
String |
topicKeySetting
Gets or sets the Topic Key setting.
|
public abstract String name
public abstract String topicKeySetting
public abstract String topicEndpointUri
public abstract String dataType
Defines how Functions runtime should treat the parameter value. Possible values are:
Copyright © 2022. All rights reserved.