Go SDK to interface with the KUSANAGI™ framework (http://kusanagi.io).
- KUSANAGI framework 3.0+
- Go 1.15+
- libzmq 4.2.5+
Install the SDK using the following command:
$ go get github.com/kusanagi/kusanagi-sdk-go/v3@epoch-3
See the getting started tutorial to begin with the KUSANAGI™ framework and the Go SDK.
The Go SDK implements support to signal deadlines or cancellation through a read only channel that is available to Middleware and Service components.
The channel can be read using the Api.Done()
method. For example, within a service action:
func handler(action *kusanagi.Action) (*kusanagi.Action, error) {
// Create a context for the current service call
ctx, cancel := context.WithCancel(context.Background())
// Create a channel to get the task result
result := make(chan int)
// Run some async task
go task(ctx, result)
// Cancel the context when the service call times out
select{
case v := <-result:
action.Log(v, 6)
case <-action.Done():
cancel()
}
return action, nil
}
It is highly recommended to monitor this channel and stop any ongoing task when the channel is closed.
See the API for a technical reference of the SDK.
For help using the framework see the documentation.
Please first read our contribution guidelines.
We use milestones to track upcoming releases inline with our versioning strategy, and as defined in our roadmap.
If you'd like to know how you can help and support our Open Source efforts see the many ways to get involved.
Please also be sure to review our community guidelines.
Copyright 2016-2021 KUSANAGI S.L. (http://kusanagi.io). All rights reserved.
KUSANAGI, the sword logo and the "K" logo are trademarks and/or registered trademarks of KUSANAGI S.L. All other trademarks are property of their respective owners.
Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.