func NewWorker(ctx context.Context, props WorkerProps) *Worker {
	if props.MaxInactivity == 0 {
		props.MaxInactivity = time.Duration(1) * time.Hour
	}
	w := &Worker{
		lastEventTimestamp: time.Now().Unix(),
		maxInactivity:      props.MaxInactivity,
		key:                props.Key,
		handler:            props.WorkerHandler,
		SharedC:            props.SharedC,
		C:                  props.C,
		ShutdownC: make(chan error, 2),
		ErrC:      props.ErrC,
		doneC:     props.DoneC,
		UserData:  props.UserData,
	}
	go w.startLoop(ctx)
	return w
}
NewWorker creates a new worker instance
package concurrent
import (
	"context"
	"sync/atomic"
	"time"
)
type Worker struct {
	lastEventTimestamp int64
	maxInactivity time.Duration
	key string
	handler WorkerHandler
	SharedC <-chan executeRequest
	C chan workerRequest
	ShutdownC chan error
	ErrC <-chan error
	doneC chan<- workerDestroyed
	UserData interface{}
}
type WorkerEvent interface {
	GetWorker() *Worker
}
type ErrorWorkerEvent struct {
	Worker *Worker
	Error  error
}
func (e ErrorWorkerEvent) GetWorker() *Worker {
	return e.Worker
}
type RequestWorkerEvent struct {
	Worker *Worker
	Value  interface{}
}
func (e RequestWorkerEvent) GetWorker() *Worker {
	return e.Worker
}
type WorkerHandler interface {
	Handle(ctx context.Context, req WorkerEvent) (interface{}, error)
}
type WorkerHandlerFunc func(ctx context.Context, ev WorkerEvent) (interface{}, error)
func (f WorkerHandlerFunc) Handle(ctx context.Context, ev WorkerEvent) (interface{}, error) {
	return f(ctx, ev)
}
type CreateWorkerProps struct {
	WorkerHandler WorkerHandler
	ErrC <-chan error
	UserData interface{}
	MaxInactivity time.Duration
}
type CreateWorkerEvent struct {
	Key   string
	Value interface{}
	Props *CreateWorkerProps
}
func (e CreateWorkerEvent) WorkerKey() string {
	return e.Key
}
type DestroyWorkerEvent struct {
	Worker *Worker
	Key    string
}
func (e DestroyWorkerEvent) WorkerKey() string {
	return e.Key
}
type WorkerProps struct {
	Key string
	DoneC chan<- workerDestroyed
	WorkerHandler WorkerHandler
	C chan workerRequest
	ErrC <-chan error
	SharedC <-chan executeRequest
	UserData interface{}
	MaxInactivity time.Duration
}
type workerDestroyed struct {
	Context context.Context
	Key string
	Cause error
}
type Response struct {
	Value interface{}
	Key   string
	Error error
}
type workerRequest struct {
	Context context.Context
	Key     string
	Value   interface{}
	Out     chan Response
	Count   *int32
}
type broadcastRequest struct {
	Context context.Context
	Value   interface{}
	Out     chan Response
}
type executeRequest struct {
	Context context.Context
	Value   interface{}
	Out     chan Response
}
func (r workerRequest) GetContext() context.Context {
	return r.Context
}
func (r broadcastRequest) GetContext() context.Context {
	return r.Context
}
func (r executeRequest) GetContext() context.Context {
	return r.Context
}