Added a new documentation structure with details of concepts, tutorials and examples
48 lines
1.3 KiB
Markdown
48 lines
1.3 KiB
Markdown
---
|
|
title: "Trigger"
|
|
draft: false
|
|
weight: 44
|
|
---
|
|
|
|
### Create a HTTP Trigger
|
|
|
|
You can create a HTTP trigger with default method (GET) for a function:
|
|
|
|
```
|
|
$ fission ht create --url /hello --function hello
|
|
trigger '94cd5163-30dd-4fb2-ab3c-794052f70841' created
|
|
```
|
|
|
|
### Create a Time Trigger
|
|
|
|
Time based triggers can be created with cron specifications:
|
|
|
|
```
|
|
$ fission tt create --name halfhourly --function hello --cron "0 30 * * *"
|
|
trigger 'halfhourly' created
|
|
```
|
|
|
|
Also a more friendly syntax such "every 1m" or "@hourly" can be used to create a time based trigger.
|
|
|
|
```
|
|
$ fission tt create --name minute --function hello --cron "@every 1m"
|
|
trigger 'minute' created
|
|
```
|
|
|
|
You can list time based triggers to inspect their associated function and cron specifications:
|
|
|
|
```
|
|
$ fission tt list
|
|
NAME CRON FUNCTION_NAME
|
|
halfhourly 0 30 * * * hello
|
|
minute @every 1m hello
|
|
```
|
|
|
|
### Create a MQ Trigger
|
|
|
|
For creating a MQ based trigger which will invoke the function when a new message arrives in newfile topic, you can use the syntax below. The response of the function execution will be sent to topic newfileresponse.
|
|
|
|
```
|
|
$ fission mqt create --name hellomsg --function hello --mqtype nats-streaming --topic newfile --resptopic newfileresponse
|
|
trigger 'hellomsg' created
|
|
``` |