Giter Club home page Giter Club logo

zebus.samples's Introduction

Zebus Samples

Getting started

  1. Open src/Zebus.Samples.sln in Visual Studio 2010 or later
  2. Restore NuGet packages and build solution
  3. Start the 'in memory directory' located in src\packages\Zebus.Directory.Standalone.[version]\tools\Abc.Zebus.Directory.exe

Sample details

1. Publishing an event

This sample shows you how to publish an event from a peer, and handle it in another.

The Publish.Sender console application will simply publish an event (SomethingHappened) every 500ms.

The Publish.Listener console application will listen to this event type and log something every time it receives it.

2. Sending a command

This sample shows you how to deal with commands : it demonstrates how a command is sent, how a peer handles a command and how the command handling can be awaited by the sender. It shows also how to use StructureMap to inject external dependencies in handlers (see the ThingsDoneCounter in the Listener's CommandHandler). Important : you must start the listener before the sender(s). If you don't, the sender(s) will throw an InvalidOperationException because they are not able to send a command that is not handled by any peer.

The Sending.Listener console application will handle the CountDoneThingsCommand command, increment a static counter with the value given in the command and then publish an event (NewThingsHaveBeenDone) telling all peer that listen this event the new value of the counter. The command handler will sleep for about 300 ms each time it handles a command in order to demonstrate how sender can actually wait for a command to be processed.

The Sending.Sender console application will send a CountDoneThingsCommand command and wait until the command is fully handled. This console will also listen for the NewThingsHaveBeenDone events and log them.

zebus.samples's People

Contributors

alprema avatar ablanchet avatar ltrzesniewski avatar

Stargazers

 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.