SFEOS Game Pub/Sub Development Building Block

in utopian-io •  2 years ago  (edited)


New Feature: Developer Building Blocks

  • This repository is a sub repository in the SFEOS github organization and is meant to be a building block example repository that SFEOS prototype developers can use to implement a very simple pub/sub event bus system without the overhead of an actual event bus. It uses MediatR, which in turn uses Dependency Injection to register and handle event publishing to subscribers. This repository follows the DDD (Domain Driven Design) Domain Events pattern (you can read more about it here).

Summary of Its Use

  • First you must add the Event class to the Dependency Injection Container. The Event class can hold any data that needs to be published to the subscribers.
  • Once you have the Event class added you can publish a message to any subscriber class(es) that might be interested in the event.
_mediator.Publish(new ScannerEventCompleted("Some result from the scan."));
  • Any service or aggregate can subscribe to the event by inheriting from the NotificationHandler and then implementing the HandleCore method.
public class NotificationService : NotificationHandler<ScannerEventCompleted>
    protected override void HandleCore(ScannerEventCompleted message)
        // do anything that needs done after the event happened.

Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Your contribution cannot be approved because it is not as informative as other contributions. See the Utopian Rules. Contributions need to be informative and descriptive in order to help readers and developers understand them.

There must be more than just the default files in your repo for a contribution to be valid and worth the reward.

I like the project idea, please do not submit a post before there is something substantial to contribute.

You can contact us on Discord.

Thank you for the info and I'll wait to do more contributions when we have more to show. Thanks again...