0
votes

i am trying to trigger a java function each time my IoT Hub receives a batch of 64 messages (or whatever, the number is not important). I followed this guide to create the basic code, then i edited creating this function

public class Function {

@FunctionName("ProcessIotMessages")
public void processIotMessages(
        @EventHubTrigger(name = "message",
                eventHubName = "samples-workitems",
                connection = "HUB-1544-DEV_events_IOTHUB") List<String> messages,
        final ExecutionContext context) {...Function Logic...}
}

The connection parameter is the IoT Hub connection string in formatted as event hub compatible endpoint (e.g. Endpoint=sb://iothub-hostname-blablabla).

I package and deploy this code with maven plugins specified in the guide linked above. The deploys works fine, i can see mi function up and running with no errors from the portal, the HUB-1544-DEV_events_IOTHUB setting app is correctly created with the correct connection string.

The only strange thing i notice in the portal is in the trigger blade. As you can see, cardinality is One, while it should be set to many, since i did not specify the cardinality parameter in the function. The default one is many according to this guide. This makes me think that i not being able to pass the correct trigger syntax.

Anyway, the problem is that this function is not starting either from my local machine or the portal. Any suggestions? Thx

1
eventHubName = "samples-workitems", - this looks a little strage, are you sure that's the right name? (Portal -> your IoT Hub -> Built-in endpoints)?evilSnobu
It's the name listed inBuilt-in endpoints as Event Hub-compatible name. In the Connection String the name is under EntityPath.evilSnobu
Thank you very much! that worked. That was a dumb error actually...my bad. Thank you very much again :)vsam490

1 Answers

0
votes

As @evilSnobu posted in the comments, the problem was the event hub name. Just go to Portal -> your IoT Hub -> Built-in endpoints and find all the information to configure the trigger in there.