consumer

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrokerAliceConsumer

type BrokerAliceConsumer struct {
	// contains filtered or unexported fields
}

BrokerAliceConsumer implements the consumer interface

func (*BrokerAliceConsumer) AddClientProducer

func (ac *BrokerAliceConsumer) AddClientProducer(producer producer.BrokerProducerI)

func (*BrokerAliceConsumer) ConsumeMessages

func (ac *BrokerAliceConsumer) ConsumeMessages() BrokerConsumerI

ConsumeMessages starts the consumption of messages by this consumer. The consumer is started in a new goroutine. Every incoming message is passed to the handler on a new goroutine

func (*BrokerAliceConsumer) GetClientProducer

func (ac *BrokerAliceConsumer) GetClientProducer() producer.BrokerProducerI

func (*BrokerAliceConsumer) HandleRouting

func (ac *BrokerAliceConsumer) HandleRouting(msg *BrokerConsumerMessage)

func (*BrokerAliceConsumer) SetMessageHandler

func (ac *BrokerAliceConsumer) SetMessageHandler(handler func(msg *BrokerConsumerMessage, routingKey string, userID string, sessionID string)) BrokerConsumerI

SetMessageHandler sets the message handler this consumer will use. Any incoming message will be transformed and then passed to this handler

handler: func(msg *Message), the method which should handle incoming messages for this consumer

type BrokerConsumerI

type BrokerConsumerI interface {
	ConsumeMessages() BrokerConsumerI
	// (msg *broker.Message, routingKey string, userID string, sessionID string)
	SetMessageHandler(handler func(msg *BrokerConsumerMessage, routingKey string, userID string, sessionID string)) BrokerConsumerI
	GetClientProducer() producer.BrokerProducerI
	AddClientProducer(producer producer.BrokerProducerI)
}

A Consumer belongs to a broker and consumes messages from a queue

func NewBrokerAliceConsumer

func NewBrokerAliceConsumer(consumer alice.Consumer, routingKeyStore keyvaluestore.Interface, serviceName string) BrokerConsumerI

type BrokerConsumerMessage

type BrokerConsumerMessage struct {
	Headers map[string]interface{}
	Body    []byte
}

BrokerConsumerMessage describes the message to be handled by the message consumer

Jump to

Keyboard shortcuts

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