Giter Site home page Giter Site logo

opine.sample.plugin's Introduction

Opine.Sample.Plugin

Event-sourced sample for the Opine framework

Getting Started

Cloning and building

First, clone the Opine Framework and build it.

git clone https://github.com/cpersona/Opine
cd Opine
dotnet build

Then clone the sample and build it. It should sit as a sibling to Opine.

git clone https://github.com/cpersona/Opine.Sample.Plugin
cd Opine.Sample.Plugin
dotnet build

Running the sample

In VSCode, debug the Opine framework using the "Go Opine.Job" launch task. (Press F5). This will run through commands in the message store and dispatch them. Change launch.json and replace "commands" with "events" to run through events and call projections.

In an actual test or production environment, you would have separate instances running, one for commands and one for events.

Key Concepts

Aggregate

The CustomerAggregate is responsible for ensuring consistency within the Customer root. You can create a customer, add a subscription, or end the current subscription. The following events are raised:

  • Created
  • SubscriptionAdded
  • SubscriptionRemoved

Command handler

The CustomerCommandler class handles commands sent to a Customer. The following commands are handled:

  • Create
  • AddSubscription
  • RemoveSubscription

Projections

The CustomerProjection and CustomerSubscriptionProjections handle events and would be used to project data into respective tables in a database. These classes are called when processing the "events" stream (-s option in launch.json).

Message store

The SampleMessageStore is a simple in-memory message store used to simulate a store such as EventStore. It is pre-loaded with events and commands to allow for testing command handling and event handling.

Unit of work

The SampleUnitOfWork is a no-op class. In a real scenario, data would be persisted to EventStore after commands have been processed or to a database after events have been processed and projections have run.

Snapshot store

The SampleSnapshotStore is a no-op class. In a real scenario, snapshots would be saved to and loaded from EventStore or relational database depending on requirements.

opine.sample.plugin's People

Contributors

cpersona avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.