|
| 1 | +# Event Source for HTTP Polling |
| 2 | + |
| 3 | +This event source launches periodic HTTP requests against an external system endpoint, turning received requests into [CloudEvents][ce] to be consumed by other TriggerMesh components. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- An external system that exposes an HTTP endpoint. |
| 8 | +- When using HTTP basic authentication, a secret containing the password. |
| 9 | + |
| 10 | +## Deploying an Instance of the HTTP Poller Source |
| 11 | + |
| 12 | +Open the Bridge creation screen and add a source of type `HTTP Poller`. |
| 13 | + |
| 14 | +In the Source creation form add the following information: |
| 15 | + |
| 16 | +- **Name**: all TriggerMesh components need a unique name per namespace. |
| 17 | +- **Broker**: request converted into [CloudEvents][ce] will be sent to this location. |
| 18 | +- **EventType**: string that identifies the purpose for all CloudEvent messages produced from this source. |
| 19 | +- **EventSource**: (optional) string that identifies the origin for all CloudEvent messages produced from this source. |
| 20 | +- **Enpoint**: URL location for the remote service to be polled. |
| 21 | +- **Method**: HTTP method. |
| 22 | +- **Frequency**: periodicity for requests formatted as [Go duration][go-duration]. |
| 23 | +- **CA Certificate**: (optional) CA certificate configured for TLS connection as plain text. |
| 24 | +- **Skip Verify**: (optional) when set to true skips remote server TLS certificate verification. |
| 25 | +- **Basic Auth Username**: (optional) HTTP basic authentication username. |
| 26 | +- **Basic Auth Password** (optional) points to a secret that contains the HTTP basic authentication password. |
| 27 | +- **Headers** (optional) is a set of key/value pairs that will be set within the HTTP request. |
| 28 | + |
| 29 | +`Frequency` is formatted after [Go's duration parsing][go-duration]. Most typically this value will contain a number followed by one of "ns", "us" or "µs", "ms", "s", "m", "h". Valid examples are `15000ms` or `15s` for 15 seconds, `60m` or `1h` for one hour. |
| 30 | + |
| 31 | +When using `CA Certificate` it should be copied into the text area in plain text. |
| 32 | + |
| 33 | +After clicking the `Save` button, you will be taken back to the Bridge editor. Proceed to adding the remaining components to the Bridge, then submit it. |
| 34 | + |
| 35 | +## Events Types |
| 36 | + |
| 37 | +The HTTP Poller Source creates a CloudEvent for each request received. CloudEvents header values are filled according to these rules: |
| 38 | + |
| 39 | +- `event-type` is set to the source's provided value. |
| 40 | +- `event-source` is set to the source's provided value. |
| 41 | +- `id` is set to a generated UID. |
| 42 | +- `date` is timestamped when generating the CloudEvent at Triggermesh. |
| 43 | + |
| 44 | +Request response body is used to fill the CloudEvent data. |
| 45 | + |
| 46 | +[ce]: https://cloudevents.io |
| 47 | +[go-duration]: https://golang.org/pkg/time/#ParseDuration |
0 commit comments