Published: 10 Feb 2018 › Updated: 10 Feb 2018
SFEOS Game Pub/Sub Development Building Block
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.
services.AddMediatR(typeof(ScannerEventCompleted));
- 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
Leave SFEOS Game Pub/Sub Development Building Block to:
Read more #utopian-io posts
Best Posts From sfeos
We have not curated any of sfeos's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From sfeos
- EOS Cafe's Block Producer Candidacy Announced
- SFEOS Interview on Technology and Choice Podcast
- EOS / SFEOS Meetup Discussion for Grand Rapids Blockchain
- SFEOS Game Pub/Sub Development Building Block
- SFEOS Art Contest Winners!
- SFEOS Development and Utopian.io
- SFEOS Founder Token Opportunity
- SFEOS Announcement - Initial Founder Tokens
- The Pitch For SFEOS
- SFEOS Game Design (Part 5 - The Game Canvas - A Web Scroller Game)