apache-flinkflink-statefun

What templating parameters does Flink Stateful Functions URL Path Template support?


When deploying Flink Stateful Functions, one needs to specify what the endpoints for the functions are, i.e. what URL does Flink need to hit in order to trigger the execution of a remote function.

The docs state:

The URL template name may contain template parameters that are filled in based on the function’s specific type. For example, a message sent to message type com.example/greeter will be sent to http://bar.foo.com/greeter.

endpoints:
  - endpoint:
    meta: 
      kind: http
    spec:
      functions: com.example/*
      urlPathTemplate: https://bar.foo.com/{function.name}

What other templating values does the urlPathTemplate support and where are these values taken from?


Solution

  • The only template value supported at the moment is the function name. i.e. the last value after the last forward slash /. You can place it wherever you would like in the template as long as it would resolve to a legal url at the end.

    For example, this is also a valid template:

    http://{function.name}.prod.svc.example.com

    Then, a message address to com.example/greeter (in your example, with my new template) would resolve to:

    http://greeter.prod.svc.example.com

    If you are missing any other template parameters, feel free to connect with the Flink community over the user mailing list/JIRA. I'm sure they would be happy to learn about new uses cases ;-)