Instead of factory, you will need to inject broker and backend objects to the server constructor:
import ( "github.com/RichardKnop/machinery/v2" backendsiface "github.com/RichardKnop/machinery/v1/backends/iface" brokersiface "github.com/RichardKnop/machinery/v1/brokers/iface" ) var broker brokersiface.Broker var backend backendsiface.Backend server, err := machinery.NewServer(cnf, broker, backend) if err != nil { // do something with the error }