Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1.08 KB

README.md

File metadata and controls

31 lines (22 loc) · 1.08 KB

Activity Ingestion Microservice

go.mod Go version


Main Components

Consumer

Listens for messages coming from ActivityFired and SendActivityDigest subjects by creating two subscriptions through Stream method provided by the consumer. Both subscription are created under the group name activity-ingestion-svc so that in case of horizontal scaling e ach message will be randomly balanced to only one of the subscribers

consumer, err := natskit.NewConsumer(natsURL, log)

h1 := func(ctx context.Context, msg *nats.Msg) error {...}
consumer.Stream(ctx, "ActivityFired", "activity-ingestion-svc", h1)

h2 := func(ctx context.Context, msg *nats.Msg) error { ... }
consumer.Stream(ctx, "SendActivityDigest", "activity-ingestion-svc", h2)

Producer

Publish messages to ActivityDigest subject

producer, err := natskit.NewProducer(natsURL, log)
producer.Publish("ActivityDigest", activityDigestMessage)