https://github.com/learningbyexample/kotlinserverless
https://github.com/learningbyexample/kotlinserverless
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/learningbyexample/kotlinserverless
- Owner: LearningByExample
- License: mit
- Created: 2017-07-22T19:13:32.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-22T19:20:34.000Z (over 8 years ago)
- Last Synced: 2025-03-15T10:30:07.161Z (10 months ago)
- Language: Shell
- Size: 7.81 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
## Kotlin Serverless
This is a small example illustrating [this blog post](https://www.juan-medina.com/2017/07/21/kotlin-serverless/)
about doing Serverless functions in Kotlin.
First I recommend to read this [article](https://martinfowler.com/articles/serverless.html) by [Mike Roberts](https://twitter.com/mikebroberts) from Martin Fowler website to get a bit more understanding on what is a Serverless architecture.
Them we should take a loot to the [System Overview](https://github.com/apache/incubator-openwhisk/blob/master/docs/about.md) of [Apache Openwhisk](http://openwhisk.incubator.apache.org/).
You need to have OpenWhisk up and running, them fist build this function:
```shell
$ mvnw package
```
Now you could add an action to OpenWhisk with:
```shell
$ cd target
$ wsk action create Fibonacci KotlinServerless-1.0-SNAPSHOT-jar-with-dependencies.jar --main \
org.learning.by.example.serverless.kotlin.FibonacciKt
```
To test the new action just run:
```shell
$ wsk action invoke --result Fibonacci --param numbers 5
```
This will output something like:
```json
{
"result": [
1,
1,
2,
3,
5
]
}
```