Flexbase
  • Flexbase
  • Introduction
  • #JoyofCoding with Flexbase
  • Core Concepts
    • Flexbase
    • Flexstudio
      • Commands & Events
  • Thinking in Flexbase
    • Features and Modules
    • Designing APIs using Flexbase Control Flow
  • Sample Application
  • Solution Structure
    • Getting Started
      • Application
        • Introduction to Solution
        • Demo - Solution Generation
        • Solution Structure Overview
        • Architecture Overview
        • Clean architecture layer
        • Common Configurations
      • Features
        • Understanding Feature
        • Use Case
        • First Feature - Add Customer
        • Second Feature - Update Customer
        • Third Feature - Delete Customer
        • Query Features
  • Input Output Models
  • Messages
  • Domain
  • Pre Bus
  • Post Bus
  • Subscribers
  • Bus Gamma
  • Persistence
  • Hosting
  • Startup Code - WebAPI
  • Startup Code - Background Job
  • Endpoint - AppSettings
  • Bridge
  • Basic CRUD - Insert & Update
  • Introduction
  • View Generated API Definition in Swagger
  • Walkthrough Generated Code Insert
  • Walkthrough Generated Code Query GetById
  • Domain Model
  • Migration
  • AppSettings
  • Bus : How Basic Routing Config Works
  • INSERT : Input API Model
  • INSERT : Attribute Validation
  • INSERT : Plugin Validation
  • INSERT : Mapper
  • INSERT : Controller
  • INSERT : Services
  • INSERT : PostBus Handler
  • INSERT : PostBus Subscriber
  • INSERT : Demo In Action
  • QUERY : Output API Model
  • QUERY : Build and Fetch Pattern
  • QUERY : Demo In Action
  • Basic CRUD 2
    • Introduction
    • View Generated API Definition In Swagger
  • Walkthrough Generated Code Update
  • Walkthrough Generated Code Delete
  • Walkthrough Generated Code GetList
  • Walkthrough Generated Code Get Paged List
  • Update In Action
  • Delete In Action
  • GetList In Action
  • GetPagedList In Action
  • Konarch
Powered by GitBook
On this page
  1. Core Concepts
  2. Flexstudio

Commands & Events

Understanding the concept of commands and events

Domain events (or events, for short) are a very important part of any application developed on Flexbase.

Synchronous applications are fundamentally different from asynchronous applications and are written using a messaging paradigm. The messaging paradigm used in Flexbase is event driven design

Commands are messages that are sent to Flexbase to execute a domain event. The domain event can be a database update or a web service call.

Commands and events are both messages.

Commands are worded as imperatives eg. InitiateFundsTransfer. Events are worded in the past tense eg. FundsTransferCompleted

This is the foundation concept for building features in Flexbase using Pub-Sub pattern.

To state it simply, a publisher publishes events and subscriber subscribes events.

A publisher is not aware of the existence of subscribers.

For example, in the above example, the event FundsTransferCompleted can be subscribed by two subscriber SendSMStoCustomer and SendEmailtoCustomer

The event FundsTransferCompleted will have the necessary data that is needed by the Subscribers. The subscribers can call a SMS and Email service respectively.

Because the subscribers are asynchronous, decoupling of the services is achieved.

PreviousFlexstudioNextThinking in Flexbase

Last updated 1 year ago