0

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

vsam490
  • 59
  • 1
  • 11
  • 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 Dec 10 '19 at 10:24
  • 1
    It's the name listed in`Built-in endpoints` as `Event Hub-compatible name`. In the Connection String the name is under EntityPath. – evilSnobu Dec 10 '19 at 10:28
  • Thank you very much! that worked. That was a dumb error actually...my bad. Thank you very much again :) – vsam490 Dec 10 '19 at 10:50

1 Answers1

0

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.

evilSnobu
  • 24,582
  • 8
  • 41
  • 71
vsam490
  • 59
  • 1
  • 11