npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eventstore-interconnect

v1.1.2

Published

Eventstore interconnector

Downloads

922

Readme

EventstoreInterconnect

The main purpose of the lib is to copy/paste an event from an eventstore to another one. The versions allowed are : v5.0.1 and v21.2.0 (also working with 2 eventstores with same version)

A usecase has been prepared in order to test the different possibilities : Given a specific configuration, the system should automatically detect the version of the source and dest Eventstore, and connect to it.

Connection

It will automatically upsert the persistent subscriptions into the source, and write events into the destination one, after checking that the events are allowed and valid.

You just have to give the correct env variables, and the version is automatically detected. So no need for redeploy when you want to upgrade your eventStore, or the one you want to write on.

Here is the list of the global env variable you might want to provide :

# For the source one, you can provide these one : 

EVENTSTORE_INTERCO_CREDENTIALS_USERNAME_SRC
EVENTSTORE_INTERCO_CREDENTIALS_PASSWORD_SRC

EVENTSTORE_INTERCO_TCP_ENDPOINT_SRC
EVENTSTORE_INTERCO_TCP_PORT_SRC

EVENTSTORE_INTERCO_HTTP_ENDPOINT_SRC
EVENTSTORE_INTERCO_HTTP_PORT_SRC

EVENTSTORE_INTERCO_CONNECTION_STRING_SRC


# For the destination one, you can provide these one : 

EVENTSTORE_INTERCO_CREDENTIALS_USERNAME_DST
EVENTSTORE_INTERCO_CREDENTIALS_PASSWORD_DST

EVENTSTORE_INTERCO_TCP_ENDPOINT_DST
EVENTSTORE_INTERCO_TCP_PORT_DST

EVENTSTORE_INTERCO_HTTP_ENDPOINT_DST
EVENTSTORE_INTERCO_HTTP_PORT_DST

EVENTSTORE_INTERCO_CONNECTION_STRING_DST


# This one is the duration of the timeout. By default it's 5000ms.
EVENTSTORE_INTERCO_EVENT_WRITER_TIMEOUT_IN_MS

# The interval both destination and source eventstore connection are tested. Default is 10_000ms
CONNECTION_LINK_CHECK_INTERVAL_IN_MS

So the only thing to do when an upgrade is needed : change these env variables, and restart the project. Defining what to run (tcp connection on legacy eventstore or grpc connection on new event store) is automatic (if http conf is provided, then the legacy eventstore will be used.)

Events

You have to provide an object containing the different events allowed to be copied. Note that you can add a validation on them, using the libs class-validator and class transformer. You have an example of event with no validation with Example2Event and an example of an event that can be validated event with Example1Event

Safety strategy

Some issues can append during the workflow. Sometimes it can happen the destination eventstore is down. Sometimes, the event won't be valid.

When an event is not writable during the timeout, the process is killed by an agressive timeout. That means that after a custom duration, by default 5 seconds (but you can give your using the EVENTSTORE_INTERCO_EVENT_WRITER_TIMEOUT_IN_MS env variable), the process will exit with code 1 by default.

When the event is invalid, it wont do anything by default, but you can override that behavior in a custom implementation.

This is called the Safety net. This basic behavior can be extended very easily when importing EventstoreInterconnectModule :

@Module({
  imports: [
    EventstoreInterconnectModule.connectToSrcAndDest(
      configuration,
      allowedEvents,
      CustomSafetyNet, // Here is the optionnal custom safty strategy you can provide
    ),
  ],
})
export class UsecaseModule {}

The custom strategy must implement the interface SafetyNet In can see in the example app a custom implementation of it

Auto kill

Every 10 seconds by default, the lib will check the connection to source and dest is ok. If the connection does not respond in this time lapse, process will exit with 1 (the timeout here is the same as the one for writting an event (EVENTSTORE_INTERCO_EVENT_WRITER_TIMEOUT_IN_MS)). You can change the value of 10 seconds by changing the env variable CONNECTION_LINK_CHECK_INTERVAL_IN_MS

Debug logs

You can switch debug logs by passing the boolean showDebugLogs in the configuration