This repository is a POC of a SDK for Dapr gRPC Components (a.k.a pluggable components)
Start by running ./run.sh
inside /examples
folder. It will start the daprd runtime with pluggable components version + default in memory state store implementation from components-contrib, use ./run.sh redis
to run redis instead.
Run
ARGS=--no-cache ./run.sh
if you want to rebuild the docker image.
See it working:
curl -X POST -H "Content-Type: application/json" -d '[{ "key": "name", "value": "Bruce Wayne", "metadata": { "ttlInSeconds": "60"}}]' http://localhost:3500/v1.0/state/default
curl http://localhost:3500/v1.0/state/default/name
To create your own implementation:
- Create a new folder under
/examples
- Implement a stateStore using the sdk
- create a
component.yml
(copying from other sources and changing the component-specific metadata) - Run
./run.sh your_folder_goes_here
This will build your component and bootstrap the dapr runtime with the default options.
Creating a new component is nothing more than implement a StateStore interface and Run the dapr component server.
package main
import (
dapr "github.com/mcandeia/dapr-components-go-sdk"
)
func main() {
dapr.MustRun(dapr.UseStateStore(MyComponentGoesHere{}))
}