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.
Click to show internal directories.
Click to hide internal directories.