Skip to main content

Posts

Showing posts from 2022

Example of Azure Event Trigger Function implemented in Java

There are so few examples of Azure Functions implemented in Java and even official documentation is a little confusing, so I decided to write my own post explaining some of the points. So here is my function class: public class EventHubTriggerFunction { /** * This function will be invoked when an event is received from Event Hub. */ @FunctionName ( "EventHubTrigger-Java" ) public void run ( @EventHubTrigger (name = "message" , eventHubName = "my-event-hubs" , connection = "EventHubConnectionString" , consumerGroup = "$Default" ) String message, final ExecutionContext context ) { context.getLogger().info( "Java Event Hub trigger function executed." ); context.getLogger().info( "Message:" + message); } } The noteworthy thing in this snippet are the annotation attributes. name : Any name that can be given to the