service

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseClient

type BaseClient struct {
	Bus          messagebus.Messagebus
	CommandQueue string
	ReplyPrefix  string
	ClientName   string
	Timeout      time.Duration
	ReplyQueue   string
	Pending      map[string]chan Envelope
	ReplyMu      sync.RWMutex
	ReplyOnce    sync.Once
	ReplyErr     error
}

BaseClient provides common client functionality for all services

func NewBaseClient

func NewBaseClient(bus messagebus.Messagebus, commandQueue, replyPrefix, clientName string, timeout time.Duration) *BaseClient

NewBaseClient creates a new base client with common functionality

func (*BaseClient) Call

func (bc *BaseClient) Call(msgType string, payload any, resp any) error

Call sends a message and waits for a reply

func (*BaseClient) ListenToQueueFiltered

func (bc *BaseClient) ListenToQueueFiltered(ctx context.Context, queueName string, messageType string, envelopes chan<- Envelope)

ListenToQueueFiltered provides a method to listen to any queue and filter envelopes by type Uses context for standard Go cancellation pattern

func (*BaseClient) Send

func (bc *BaseClient) Send(msgType string, payload any) error

Send sends a message without expecting a reply

func (*BaseClient) SendEnvelope

func (bc *BaseClient) SendEnvelope(queue string, env Envelope) error

SendEnvelope sends an envelope to the specified queue

func (*BaseClient) SendTo

func (bc *BaseClient) SendTo(queue, msgType string, payload any) error

SendTo sends a message to a specific queue without expecting a reply

func (*BaseClient) SendToWithReplyTo

func (bc *BaseClient) SendToWithReplyTo(queue, msgType string, payload any, replyTo string) error

SendToWithReplyTo sends a message to a specific queue with a ReplyTo override

func (*BaseClient) SendWithReplyTo

func (bc *BaseClient) SendWithReplyTo(msgType string, payload any, replyTo string) error

SendWithReplyTo sends a message to the default command queue with a ReplyTo override

type BaseService

type BaseService struct {
	Bus          messagebus.Messagebus
	CommandQueue string
}

BaseService provides common service functionality for all services

func NewBaseService

func NewBaseService(bus messagebus.Messagebus, commandQueue string) *BaseService

NewBaseService creates a new base service with common functionality

func (*BaseService) ListenToQueue

func (bs *BaseService) ListenToQueue(queueName string, envelopes chan<- Envelope, hook func(Envelope)) error

ListenToQueue provides a generic method to continuously listen to any queue and decode envelopes

func (*BaseService) ReceiveEnvelopes

func (bs *BaseService) ReceiveEnvelopes(envelopes chan<- Envelope) error

ReceiveEnvelopes receives and decodes commands from the command queue

func (*BaseService) Reply

func (bs *BaseService) Reply(req Envelope, payload any) error

Reply sends a successful reply to a request

func (*BaseService) ReplyError

func (bs *BaseService) ReplyError(req Envelope, replyErr error) error

ReplyError sends an error reply to a request

func (*BaseService) Send

func (bs *BaseService) Send(msgType string, payload any) error

Send sends a message on the service command queue

func (*BaseService) SendEnvelope

func (bs *BaseService) SendEnvelope(queue string, env Envelope) error

SendEnvelope sends an envelope to the specified queue

func (*BaseService) SendTo

func (bs *BaseService) SendTo(queue string, msgType string, payload any) error

SendTo sends to an arbitrary queue without expecting a reply

type Envelope

type Envelope = wire.Envelope

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL