func (j *Job) IsValid() error {
	if j.Topic == "" || j.ID == "" {
		return errors.New("topic or id is empty")
	}
	return nil
}
IsValid check job is valid. job is not nil and topic and id
is not empty
package job
import (
	"errors"
	"fmt"
	"time"
	"github.com/changsongl/delay-queue/pkg/lock"
)
type Job struct {
	Topic   Topic       `json:"topic,omitempty"`
	ID      ID          `json:"id,omitempty"`
	Delay   Delay       `json:"delay,omitempty"`
	TTR     TTR         `json:"ttr,omitempty"`
	Body    Body        `json:"body,omitempty"`
	Version Version     `json:"version,omitempty"`
	Mutex   lock.Locker `json:"-"`
}
func New(topic Topic, id ID, delay Delay, ttr TTR, body Body, lockerFunc lock.LockerFunc) (*Job, error) {
	j := &Job{
		Topic:   topic,
		ID:      id,
		Delay:   delay,
		TTR:     ttr,
		Body:    body,
		Version: NewVersion(),
	}
	err := j.IsValid()
	if err != nil {
		return nil, err
	}
	j.Mutex = lockerFunc(j.getLockName())
	return j, nil
}
func Get(topic Topic, id ID, lockerFunc lock.LockerFunc) (*Job, error) {
	j := &Job{
		Topic: topic,
		ID:    id,
	}
	err := j.IsValid()
	if err != nil {
		return nil, err
	}
	j.Mutex = lockerFunc(j.getLockName())
	return j, nil
}