messaging

package
v0.0.0-...-6e892aa Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoneMessage

type DoneMessage struct {
	OrderID      string
	ExecutedQty  string
	RemainingQty string
	Trades       []Trade
	Canceled     []string
	Activated    []string
	Stored       bool
	Quantity     string
	Processed    string
	Left         string
	UserAddress  string // User's wallet address
}

DoneMessage represents the message structure for the Done object to be sent to Kafka.

type MessageSender

type MessageSender interface {
	SendDoneMessage(ctx context.Context, done *DoneMessage) error
	Close() error
}

MessageSender defines an interface for sending messages This helps decouple the core package from specific implementations like Kafka in the queue package

type MockMessageSender

type MockMessageSender struct {
	SentMessages []*DoneMessage
	SendError    error // Optional error to return on SendDoneMessage
	// contains filtered or unexported fields
}

MockMessageSender implements the MessageSender interface for testing purposes. It captures sent messages instead of sending them to a real queue.

func NewMockMessageSender

func NewMockMessageSender() *MockMessageSender

NewMockMessageSender creates a new mock sender.

func (*MockMessageSender) ClearSentMessages

func (m *MockMessageSender) ClearSentMessages()

ClearSentMessages removes all captured messages.

func (*MockMessageSender) GetSentMessages

func (m *MockMessageSender) GetSentMessages() []*DoneMessage

GetSentMessages returns a copy of the captured messages.

func (*MockMessageSender) SendDoneMessage

func (m *MockMessageSender) SendDoneMessage(ctx context.Context, done *DoneMessage) error

SendDoneMessage captures the message and returns an optional pre-configured error.

func (*MockMessageSender) SetSendError

func (m *MockMessageSender) SetSendError(err error)

SetSendError allows configuring an error to be returned by SendDoneMessage.

type Trade

type Trade struct {
	OrderID     string
	Role        string
	Price       string
	Quantity    string
	IsQuote     bool
	UserAddress string // User's wallet address
}

Trade represents a single trade execution

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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