Skip to content

Latest commit

 

History

History
68 lines (42 loc) · 2.15 KB

File metadata and controls

68 lines (42 loc) · 2.15 KB

OpenWhisk Annotations for Java

This module is part of the Apache OpenWhisk project.

This project allows developers to define actions, packages, rules and triggers from annotations on java classes.

Pre-requisite

The following softwares are required to use this project:

Adding the Annotations

All of the annotations are added at the class level. You can define more than one annotation per class.

Action Annotation

The @Action annotation defines an OpenWhisk action:

@Action(name = "simple-function", packageName = "test", parameters = { @Parameter(key = "Name", value = "Bob") })
public class FunctionApp {

ActionSequence Annotation

The @ActionSequence annotation defines an OpenWhisk action sequence:

@Action(name = "simple-function", packageName = "test", parameters = { @Parameter(key = "Name", value = "Bob") })
public class FunctionApp {

Package Annotation

The @Package annotation defines an OpenWhisk package:

@Package(name = "test")
public class FunctionApp {

Our recommendation would be to add this to a package-info.java class for the package containing the actions / code for a particular package.

Rule Annotation

The @Rule annotation defines an OpenWhisk rule:

@Rule(actionName="test/simple-function", name = "dostuffrule", triggerName="dostuff")
public class FunctionApp {

Trigger Annotation

The @Trigger annotation defines an OpenWhisk trigger:

@Trigger(feed = "/whisk.system/alarms/alarm", name = "dostuff", parameters = { @Parameter(key = "cron", value = "5 * * * *")})
public class FunctionApp {