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()
}