package created

This commit is contained in:
nquidox 2026-02-21 16:57:42 +03:00
parent 353dcd6fe6
commit 71e2e1b7b1
5 changed files with 216 additions and 1 deletions

View file

@ -0,0 +1,42 @@
package processor
import (
"context"
"fmt"
"net"
"task-processor/internal/taskAgent"
)
const pkgLogHeader string = "Processor |"
type handler struct {
*service
}
type Addr struct {
Host string
Port string
User string
Pass string
Vhost string
}
type Deps struct {
Ctx context.Context
TA taskAgent.TaskAgent
Addr Addr
ChanLen uint
}
func NewHandler(deps Deps) Processor {
addr := makeAddr(deps.Addr)
return &handler{
service: newService(deps, addr),
}
}
func makeAddr(addr Addr) string {
//"amqp://username:password@host:port/vhost"
return fmt.Sprintf("amqp://%v:%v@%v/%v", addr.User, addr.Pass, net.JoinHostPort(addr.Host, addr.Port), addr.Vhost)
}