Skip to content

Commit

Permalink
doc: add stopAfter example
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-geller committed Feb 15, 2024
1 parent 46b6ecf commit b037ffc
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions src/main/java/io/kestra/plugin/fs/http/Trigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,34 @@
)
@Plugin(
examples = {
@Example(
title = "Send a Slack alert if the price is below a certain threshold. The flow will be triggered every 30 seconds until the condition is met. Then, the `stopAfter` property will disable the trigger to avoid unnecessary API calls and alerts.",
full = true,
code = {
"""
id: http_price_alert
namespace: dev
tasks:
- id: send_slack_alert
type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK') }}"
payload: |
{
"channel": "#price-alerts",
"text": "The price is now: {{ json(trigger.body).price }}"
}
triggers:
- id: http
type: io.kestra.plugin.fs.http.Trigger
uri: https://fakestoreapi.com/products/1
responseCondition: "{{ json(response.body).price <= 110 }}"
interval: PT30S
stopAfter:
- SUCCESS"""
}
),
@Example(
title = "Trigger a flow if an HTTP endpoint returns a status code equals to 200",
full = true,
Expand All @@ -47,12 +75,13 @@
type: io.kestra.plugin.fs.http.Trigger
uri: https://api.chucknorris.io/jokes/random
responseCondition: "{{ response.statusCode == 200 }}"
stopAfter:
- SUCCESS
tasks:
- id: hello
- id: log_response
type: io.kestra.core.tasks.log.Log
message: Kestra team wishes you a great day! 👋
"""
message: '{{ trigger.body }}'"""
}
)
}
Expand Down

0 comments on commit b037ffc

Please sign in to comment.