func (q *Adapter) Register(name string, h worker.Handler) error {
	q.Pool.Job(name, func(job *work.Job) error {
		return h(job.Args)
	})
	return nil
}
Register binds a new job, with a name and a handler.
package gwa
import (
	"context"
	"time"
	"github.com/gobuffalo/buffalo/worker"
	"github.com/gocraft/work"
	"github.com/gomodule/redigo/redis"
	"github.com/markbates/going/defaults"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
)
type Options struct {
	*redis.Pool
	Logger         Logger
	Name           string
	MaxConcurrency int
}
var _ worker.Worker = &Adapter{}
func New(opts Options) *Adapter {
	ctx := context.Background()
	opts.Name = defaults.String(opts.Name, "buffalo")
	enqueuer := work.NewEnqueuer(opts.Name, opts.Pool)
	opts.MaxConcurrency = defaults.Int(opts.MaxConcurrency, 25)
	pool := work.NewWorkerPool(struct{}{}, uint(opts.MaxConcurrency), opts.Name, opts.Pool)
	if opts.Logger == nil {
		l := logrus.New()
		l.Level = logrus.InfoLevel
		l.Formatter = &logrus.TextFormatter{}
		opts.Logger = l
	}
	return &Adapter{
		Enqueur: enqueuer,
		Pool:    pool,
		Logger:  opts.Logger,
		ctx:     ctx,
	}
}
type Adapter struct {
	Enqueur *work.Enqueuer
	Pool    *work.WorkerPool
	Logger  Logger
	ctx     context.Context
}
func (q *Adapter) Start(ctx context.Context) error {
	q.Logger.Info("Starting gocraft/work Worker")
	q.ctx = ctx
	go func() {
		select {
		case <-ctx.Done():
			q.Stop()
		}
	}()
	q.Pool.Start()
	return nil
}
func (q *Adapter) Stop() error {
	q.Logger.Info("Stopping gocraft/work Worker")
	q.Pool.Stop()
	return nil
}