Eventstore
Extends:
Base class to communicate with eventstore @emits{connected} emitted as soon as connection is established @emits{secureConnect} emitted when connection is secured connected @emits{ready} emitted after connected after authentication and identify client @emits{reconnect} emitted as soon as lib tries to reconnect (param: reconnect count) @emits{close} emitted as soon as connection is closed @emits{drain} emitted when connection drains existing requests before connection close @emits{error} emitted on connection errors (param: error)
Constructor Summary
Public Constructor | ||
public |
Creates an instance of Eventstore. |
Member Summary
Public Members | ||
public get |
Indicates if connection to eventstore is available |
|
public |
logger |
|
public get |
Get current logger instance |
|
public set |
Set logger instance |
|
public get |
Returns client id - name of eventstore connection |
Protected Members | ||
protected |
connection base |
|
protected |
connection config |
|
protected |
default read slice size |
Method Summary
Public Methods | ||
public |
atStream(streamName: , streamOptions: StreamOptions): Stream Get a stream instance specified by streamName Alias for method stream |
|
public |
Connect to eventstore |
|
public |
Disconnect from eventstore and try to drain pending requests |
|
public |
fromStream(streamName: , streamOptions: StreamOptions): Stream Get a stream instance specified by streamName Alias for method stream |
|
public |
Returns current connection |
|
public |
Ping eventstore |
|
public |
async readSliceBackward(position: Position, maxSliceCount: , resolveLinks: boolean, requireMaster: , credentials: UserCredentials | null): Promise Reads a slice from current stream in backward direction |
|
public |
async readSliceForward(position: Position, maxSliceCount: , resolveLinks: boolean, requireMaster: , credentials: UserCredentials | null): Promise Reads a slice from current stream in forward direction |
|
public |
async resolveLink(link: Event, requireMaster: , credentials: UserCredentials | null): Promise Resolves a link |
|
public |
stream(streamName: , streamOptions: StreamOptions): Stream Get a stream instance specified by streamName You can also use one of the alias functions fromStream or atStream |
|
public |
async streamNamesByCategory(category: , start: *, requireMaster: , credentials: UserCredentials): Promise Get all stream names by stream category (eventstore system projections must be enabled) |
|
public |
async walkAllBackward(start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials | null): Promise Walks all events backward |
|
public |
async walkAllForward(start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials | null): Promise Walks all events forward |
|
public |
async walkEventsByCorrelationId(correlationId: , start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials): Promise Get all events by correlation id (eventstore system projections must be enabled and eventstore server version >=5 must be installed) |
|
public |
async walkEventsByStreamCategory(category: , start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials): Promise Get all events from given stream category (eventstore system projections must be enabled) |
|
public |
async walkEventsByType(eventType: , start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials): Promise Get all events by event type (event name) (eventstore system projections must be enabled) |
Protected Methods | ||
protected |
async authenticate(): Promise Authenticate with credentials from settings |
|
protected |
async identifyClient(): Promise Called directly after connecting to eventstore Identifies connection against eventstore Identification can be set in connection settings field clientId |
|
protected |
init(connectionConfiguration: {}): void Ensure to use up-to-date settings, logger and a fresh connection socket |
|
protected |
async readSlice(direction: EventstoreCommand, position: Position, maxSliceCount: , resolveLinks: , requireMaster: , credentials: UserCredentials | null): Promise Reads a slice of events from current stream |
Public Constructors
Public Members
Protected Members
Public Methods
public atStream(streamName: , streamOptions: StreamOptions): Stream source
Get a stream instance specified by streamName Alias for method stream
Params:
Name | Type | Attribute | Description |
streamName | |||
streamOptions | StreamOptions |
public async connect(connectionConfiguration: {}): Promise source
Connect to eventstore
Params:
Name | Type | Attribute | Description |
connectionConfiguration | {} |
|
public fromStream(streamName: , streamOptions: StreamOptions): Stream source
Get a stream instance specified by streamName Alias for method stream
Params:
Name | Type | Attribute | Description |
streamName | |||
streamOptions | StreamOptions |
public async readSliceBackward(position: Position, maxSliceCount: , resolveLinks: boolean, requireMaster: , credentials: UserCredentials | null): Promise source
Reads a slice from current stream in backward direction
Params:
Name | Type | Attribute | Description |
position | Position | ||
maxSliceCount | |||
resolveLinks | boolean |
|
|
requireMaster | |||
credentials | UserCredentials | null |
public async readSliceForward(position: Position, maxSliceCount: , resolveLinks: boolean, requireMaster: , credentials: UserCredentials | null): Promise source
Reads a slice from current stream in forward direction
Params:
Name | Type | Attribute | Description |
position | Position | ||
maxSliceCount | |||
resolveLinks | boolean |
|
|
requireMaster | |||
credentials | UserCredentials | null |
public async resolveLink(link: Event, requireMaster: , credentials: UserCredentials | null): Promise source
Resolves a link
Params:
Name | Type | Attribute | Description |
link | Event | ||
requireMaster | |||
credentials | UserCredentials | null |
public stream(streamName: , streamOptions: StreamOptions): Stream source
Get a stream instance specified by streamName You can also use one of the alias functions fromStream or atStream
Params:
Name | Type | Attribute | Description |
streamName | |||
streamOptions | StreamOptions |
public async streamNamesByCategory(category: , start: *, requireMaster: , credentials: UserCredentials): Promise source
Get all stream names by stream category (eventstore system projections must be enabled)
Params:
Name | Type | Attribute | Description |
category | |||
start | * |
|
|
requireMaster | |||
credentials | UserCredentials |
public async walkAllBackward(start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials | null): Promise source
Walks all events backward
Params:
Name | Type | Attribute | Description |
start | * |
|
|
resolveLinks | boolean |
|
|
requireMaster | |||
credentials | UserCredentials | null |
public async walkAllForward(start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials | null): Promise source
Walks all events forward
Params:
Name | Type | Attribute | Description |
start | * |
|
|
resolveLinks | boolean |
|
|
requireMaster | |||
credentials | UserCredentials | null |
public async walkEventsByCorrelationId(correlationId: , start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials): Promise source
Get all events by correlation id (eventstore system projections must be enabled and eventstore server version >=5 must be installed)
Params:
Name | Type | Attribute | Description |
correlationId | |||
start | * |
|
|
resolveLinks | boolean |
|
|
requireMaster | |||
credentials | UserCredentials |
public async walkEventsByStreamCategory(category: , start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials): Promise source
Get all events from given stream category (eventstore system projections must be enabled)
Params:
Name | Type | Attribute | Description |
category | |||
start | * |
|
|
resolveLinks | boolean |
|
|
requireMaster | |||
credentials | UserCredentials |
public async walkEventsByType(eventType: , start: *, resolveLinks: boolean, requireMaster: , credentials: UserCredentials): Promise source
Get all events by event type (event name) (eventstore system projections must be enabled)
Params:
Name | Type | Attribute | Description |
eventType | |||
start | * |
|
|
resolveLinks | boolean |
|
|
requireMaster | |||
credentials | UserCredentials |
Protected Methods
protected async identifyClient(): Promise source
Called directly after connecting to eventstore Identifies connection against eventstore Identification can be set in connection settings field clientId
protected init(connectionConfiguration: {}): void source
Ensure to use up-to-date settings, logger and a fresh connection socket
Params:
Name | Type | Attribute | Description |
connectionConfiguration | {} |
|
protected async readSlice(direction: EventstoreCommand, position: Position, maxSliceCount: , resolveLinks: , requireMaster: , credentials: UserCredentials | null): Promise source
Reads a slice of events from current stream
Params:
Name | Type | Attribute | Description |
direction | EventstoreCommand | ||
position | Position | ||
maxSliceCount | |||
resolveLinks | |||
requireMaster | |||
credentials | UserCredentials | null |