We've just published a rather interesting .NET code sample illustrating interactions between a browser and a CQRS-like server with queue processing. The sample is implemented as a snippet on top of Lokad.Cqrs, leveraging the latest codebase and new http endpoint functionality.
Just a reminder. Lokad.Cqrs is not a real framework. It is just a temp scaffolding that speeds up development of distributed systems following CQRS architecture principles. It enforces design that will make it easy to scale and move system between on-premises and cloud deployments (saving money, whenever possible). Core elements are made intentionally simple to educate and encourage eventually replacing them with solutions tailored specifically for the specific project.
HttpEndpoint is a new feature of Lokad.Cqrs, that demonstrates how easy it is to write some simple non-blocking web server and then put it to a good use. In the sample we do some interesting stuff:
- host both CQRS engine and http server in the same process;
- actually start the entire process inside a unit test;
- let browser post simplified commands to the memory queue on the server;
- process these commands in async, aggregating results to a simple view;
- use this view to display info back in the web browser.
Sounds cool enough for a simple sample? Here's how it actually looks like:
Interested to see how simple this code is? It is shared with the community as open source within the Lokad.Cqrs/Snippets project in hope that it will be of any help. You can:
- Check out ReadMe or just grab Lokad.CQRS (branch 'vnext') from github and run it locally.
- Ask questions in our community.
BTW, the primary reasons, why HttpEndpoint functionality was added to Lokad.Cqrs were about supporting following simple scenarios:
- network message dispatch in non-Azure deployments of systems developed with Lokad.Cqrs;
- simple secure endpoints for posting commands and querying views (problem of long lists can be solved here);
- extremely simple built-in UI for certain maintenance scenarios in Lokad.Cqrs systems that should work nicely even with fast push deployments on Azure;
- an easy way to support XML/REST/JSON integration scenarios with 3rd party systems without the need to roll out ASMX/WCF/ASP.NET or whatever over-complicated mess.
- have all these endpoints (supporting multiple virtual urls on a single server) on the same machine with the server processes, saving money on small project deployments in the cloud.
What do you think of this sample?