timer

package module
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2020 License: BSD-3-Clause Imports: 7 Imported by: 2

README

Timer Trigger

This trigger provides your flogo application the ability to schedule an action

Installation

flogo install github.com/project-flogo/contrib/trigger/timer

Configuration

Handler Settings:
Name Type Description
startDelay string The start delay (ex. 1m, 1h, etc.), immediate if not specified
repeatInterval string The repeat interval (ex. 1m, 1h, etc.), doesn't repeat if not specified

Example Configurations

Triggers are configured via the triggers.json of your application. The following are some example configuration of the Timer Trigger.

Only once and immediate

Configure the Trigger to run a flow immediately

{
  "triggers": [
    {
      "id": "flogo-timer",
      "ref": "github.com/project-flogo/contrib/trigger/timer",
      "handlers": [
        {
          "action": {
            "ref": "#flow",
            "settings": {
              "flowURI": "res://flow:myflow"
            }
          }
        }
      ]
    }
  ]
}
Only once with a delay

Configure the Trigger to run a flow once with a delay of one minute. "startDelay" settings format = "[hours]h[minutes]m[seconds]s"

{
  "triggers": [
    {
      "id": "flogo-timer",
      "ref": "github.com/project-flogo/contrib/trigger/timer",
      "handlers": [
        {
          "settings": {
            "startDelay": "1m"
          },
          "action": {
            "ref": "#flow",
            "settings": {
              "flowURI": "res://flow:myflow"
            }
          }
        }
      ]
    }
  ]
}
Repeating

Configure the Trigger to run a flow repeating every 10 minutes. "repeatInterval" settings format = "[hours]h[minutes]m[seconds]s"

{
  "triggers": [
    {
      "id": "flogo-timer",
      "ref": "github.com/project-flogo/contrib/trigger/timer",
      "handlers": [
        {
          "settings": {
            "repeatInterval": "10m"
          },
          "action": {
            "ref": "github.com/project-flogo/flow",
            "settings": {
              "flowURI": "res://flow:myflow"
            }
          }
        }
      ]
    }
  ]
}
Repeating with start delay

Configure the Trigger to run a flow every minute, with a delayed start of 10 minutes and 30 seconds.

{
  "triggers": [
    {
      "id": "flogo-timer",
      "ref": "github.com/project-flogo/contrib/trigger/timer",
      "handlers": [
        {
          "settings": {
            "repeatInterval": "1m",
            "startDelay": "10m30s"
          },
          "action": {
            "ref": "github.com/project-flogo/flow",
            "settings": {
              "flowURI": "res://flow:myflow"
            }
          }
        }
      ]
    }
  ]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
}

func (*Factory) Metadata

func (*Factory) Metadata() *trigger.Metadata

Metadata implements trigger.Factory.Metadata

func (*Factory) New

func (*Factory) New(config *trigger.Config) (trigger.Trigger, error)

New implements trigger.Factory.New

type HandlerSettings

type HandlerSettings struct {
	StartInterval  string `md:"startDelay"`     // The start delay (ex. 1m, 1h, etc.), immediate if not specified
	RepeatInterval string `md:"repeatInterval"` // The repeat interval (ex. 1m, 1h, etc.), doesn't repeat if not specified
}

type Trigger

type Trigger struct {
	// contains filtered or unexported fields
}

func (*Trigger) Initialize

func (t *Trigger) Initialize(ctx trigger.InitContext) error

Init implements trigger.Init

func (*Trigger) Start

func (t *Trigger) Start() error

Start implements ext.Trigger.Start

func (*Trigger) Stop

func (t *Trigger) Stop() error

Stop implements ext.Trigger.Stop

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL