builder

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateMeta

type AggregateMeta struct {
	ID          objectid.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	AggregateID int8              `bson:"aggregateID,omitempty" json:"aggregateID,omitempty"`
	Version     int64             `bson:"version,omitempty" json:"version,omitempty"`
}

AggregateMeta contains current versions for Aggregates. This version is updated everytime an Aggregate receives an associated Event.

type EventResponse

type EventResponse struct {
	Event model.Event
	Error error
}

EventResponse is the response distributed over the EventsIO channels.

type EventsIO

type EventsIO struct {
	// contains filtered or unexported fields
}

EventsIO allows interacting with the AggBuilder service. This is the medium through which the new events are distributed.

func Init

func Init(config IOConfig) (*EventsIO, error)

Init initializes the AggBuilder service.

func (*EventsIO) BuildState

func (e *EventsIO) BuildState(
	correlationID uuuid.UUID,
	timeoutSec int,
) (<-chan *EventResponse, error)

BuildState gets events from EventStore-service.

func (*EventsIO) Close

func (e *EventsIO) Close()

Close closes any open routines associated with AggBuilder service, such as Kafka Producers and Consumers. Use this when the service is no longer required.

func (*EventsIO) Context

func (e *EventsIO) Context() context.Context

Context returns the errgroup-context used for AggBuilder-routines.

func (*EventsIO) ErrGroup

func (e *EventsIO) ErrGroup() *errgroup.Group

ErrGroup returns the errgroup used for AggBuilder-routines.

func (*EventsIO) Wait

func (e *EventsIO) Wait() <-chan error

Wait is a wrapper for errgroup.Wait, and will wait for all AggBuilder and RoutinesGroup routines to exit, and propagate the error from errgroup.Wait. This is not meant to do FanOut, it always returns the same channel. FanOut logic must be implemented by library-user. Note: The resulting channel will get data only once, and is then closed.

type IOConfig

type IOConfig struct {
	KafkaConfig KafkaConfig
	MongoConfig MongoConfig
}

IOConfig is the configuration for AggBuilder service.

type KafkaConfig

type KafkaConfig struct {
	// Consumer for EventStoreQuery-response
	// The first topic in Consumer-Topics is used as "Topic" field for EventStoreQuery.
	ESQueryResCons *kafka.ConsumerConfig
	EOSToken       string

	// Producer for making requests to ESQuery
	ESQueryReqProd *kafka.ProducerConfig
	// Topic on which requests to EventStoreQuery should be sent.
	ESQueryReqTopic string
}

KafkaConfig is the configuration for Kafka, such as brokers and topics.

type MongoConfig

type MongoConfig struct {
	AggregateID   int8
	AggCollection *mongo.Collection
	// Collection/Database in which Aggregate metadata is stored.
	Connection         *mongo.ConnectionConfig
	MetaDatabaseName   string
	MetaCollectionName string
}

MongoConfig is the configuration for MongoDB client.

Jump to

Keyboard shortcuts

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