Documentation ¶
Index ¶
- func ConnectNats(cfg Config) (stan.Conn, error)
- type Config
- type Conn
- type EventStore
- func (es *EventStore) Append(event *fes.Event) error
- func (es *EventStore) Close() error
- func (es *EventStore) Get(aggregate fes.Aggregate) ([]*fes.Event, error)
- func (es *EventStore) List(matcher fes.AggregateMatcher) ([]fes.Aggregate, error)
- func (es *EventStore) RunConnectionChecker()
- func (es *EventStore) Watch(aggregate fes.Aggregate) error
- type WildcardConn
- type WildcardSub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectNats ¶
Types ¶
type Conn ¶
type Conn struct {
stan.Conn
}
Conn is a wrapper of 'stan.Conn' struct to augment the API with bounded subscriptions and channel-based subscriptions
func (*Conn) MsgSeqRange ¶
func (*Conn) SubscribeChan ¶
type EventStore ¶
EventStore is a NATS-based implementation of the EventStore interface.
func Connect ¶
func Connect(cfg Config) (*EventStore, error)
Connect to a NATS cluster using the config.
func NewEventStore ¶
func NewEventStore(conn *WildcardConn, cfg Config) *EventStore
func (*EventStore) Append ¶
func (es *EventStore) Append(event *fes.Event) error
Append publishes (and persists) an event on the NATS message queue
func (*EventStore) Close ¶
func (es *EventStore) Close() error
func (*EventStore) List ¶
func (es *EventStore) List(matcher fes.AggregateMatcher) ([]fes.Aggregate, error)
List returns all entities of which the subject matches the matcher. A nil matcher is considered a 'match-all'.
func (*EventStore) RunConnectionChecker ¶
func (es *EventStore) RunConnectionChecker()
type WildcardConn ¶
type WildcardConn struct {
*Conn
}
WildcardConn is an abstraction on top of Conn that provides wildcard support
func NewWildcardConn ¶
func NewWildcardConn(conn stan.Conn) *WildcardConn
func (*WildcardConn) List ¶
func (wc *WildcardConn) List(matcher fes.AggregateMatcher) ([]string, error)
List retrieves all mentioned entities on the activity channel. The results can be filtered using the matcher, with a nil matcher equivalent to a 'match-all'.
func (*WildcardConn) Subscribe ¶
func (wc *WildcardConn) Subscribe(wildcardSubject string, cb stan.MsgHandler, opts ...stan.SubscriptionOption) (stan.Subscription, error)
type WildcardSub ¶
type WildcardSub struct {
// contains filtered or unexported fields
}
WildcardSub is an abstraction on top of stan.Subscription that provides wildcard support
func (*WildcardSub) Close ¶
func (ws *WildcardSub) Close() error
func (*WildcardSub) Unsubscribe ¶
func (ws *WildcardSub) Unsubscribe() error