Astarte.Flow.Blocks.HttpSink (astarte_flow v0.1.0)

This is a consumer block that takes data from incoming Message and makes a POST request to the configured URL containing data. This block supports only incoming messages with type :binary, so serialization to binary format must be handled in a separate block before the message arrives here. The subtype of the message, if present, is added as Content-Type header. Additionally, static headers can be added to the POST requests with the initial configuration.

For the time being, the delivery is best-effort (i.e. if a message is not delivered, it is discarded).

Link to this section Summary

Functions

Starts the HttpSink.

Link to this section Functions

Link to this function

start_link(opts)

@spec start_link(options) :: GenServer.on_start()
when options: [option],
     option:
       {:url, url :: String.t()}
       | {:headers, headers :: [{String.t(), String.t()}]}

Starts the HttpSink.

options

Options

  • :url (required) - The target URL for the POST request.
  • :headers - A list of {key, value} tuples where key and value are String and represent headers to be set in the POST request.
  • :ignore_ssl_errors - If true, ignore SSL errors that happen while performing the request. Defaults to false.