Categorygithub.com/v0id3r/eh-nats
modulepackage
0.0.0-20201014044012-03d8ceac6172
Repository: https://github.com/v0id3r/eh-nats.git
Documentation: pkg.go.dev

# README

eh-nats

Eventbus with NATS/NATS Streaming backend for https://github.com/looplab/eventhorizon

Example init

Connection configuration

natsUrl := "nats://localhost:4222"
subject := "ehBus"
clusterId := "test-cluster"
clientId := "client-id"

Create connection

nc, err := nats.Connect(natsUrl)
conn, err := stan.Connect(clusterId, clientId, stan.NatsConn(nc))

or

conn, err := stan.Connect(clusterId, clientId, stan.NatsURL(natsUrl))

Create bus using connection

eventBus, err := nats.NewEventBus(conn, subject)

# Functions

ErrCouldNotMarshalEvent is when an event could not be marshaled into BSON.
ErrCouldNotPublishEvent is when kafka-client cannot send event to kafka.
ErrCouldNotUnmarshalEvent is when an event could not be unmarshaled into BSON.
No description provided by the author

# Structs

Error is an async error containing the error and the event.
No description provided by the author
No description provided by the author