events

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

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

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FlushCartChannelName stores redis channel name for flush cart items.
	FlushCartChannelName = "FLUSH_CART_CHANNEL"

	// CartItemPopulatedChannelName is channel name for data populated from products service.
	CartItemPopulatedChannelName = "CART_ITEM_POPULATED"
)
View Source
const (
	// PopulateCartItemChannelName channel name for cart item product info population requests.
	PopulateCartItemChannelName = "POPULATE_CART_ITEM"
)

Variables

This section is empty.

Functions

func PublishToRedis

func PublishToRedis(rds redisKind, cartItemID, productID string)

PublishToRedis publishes product data need to populate message to Redis pub/sub.

Types

type EventListener

type EventListener struct {
	FlushCartMessageChan     <-chan *redis.Message
	ProductInfoPopulatedChan <-chan *redis.Message
	Repository               database.Repository
}

EventListener is a struct which contains flush cart and product data populated messages channels.

func (*EventListener) ListenCartItemDataPopulationMessages

func (l *EventListener) ListenCartItemDataPopulationMessages()

ListenCartItemDataPopulationMessages listens messages from product data populated channel. Updates cart item with populated product data.

func (*EventListener) ListenFlushCartEvents

func (l *EventListener) ListenFlushCartEvents()

ListenFlushCartEvents listens messages from given channel and if payload matches flushes cart content.

Jump to

Keyboard shortcuts

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