The Go SDK is currently in experimental status. If you would like to provide feedback, please reach out to us with your suggestions and comments on our Discord.
Go - job.submit()
Jobs may be submitted from Nitric services
or other batches
using the submit
method on the job reference. When submitting a job you can provide a payload that will be passed to the job handler function.
import (
"context"
"github.com/nitrictech/go-sdk/nitric"
"github.com/nitrictech/go-sdk/nitric/batch"
)
func main() {
analyse := nitric.NewJob("analyse").Allow(batch.JobSubmit)
analyze.Submit(context.TODO(), map[string]interface{}{
"message": "message contents",
})
nitric.Run()
}
Parameters
- Name
message
- Required
- Required
- Type
- map[string]interface{}
- Description
The data that will be sent to the submit
Examples
Submit a job request
import (
"context"
"github.com/nitrictech/go-sdk/nitric"
"github.com/nitrictech/go-sdk/nitric/batch"
)
func main() {
analyse := nitric.NewJob("analyse").Allow(batch.JobSubmit)
analyze.Submit(context.TODO(), map[string]interface{}{
"message": "message contents",
})
nitric.Run()
}