With a microservices arhcitecture system behaviour gets spread out across many, many narrowly focused microservices. Much of the functionality in the system depends on those services collaborating. In this talk I explore different modes of collaboration between microservices, how they compare, which are preferable, and how to keep it all simple. Along the way I will show how to use HTTP for the different types of collaboration and how to use Nancy to implement them on top of ASP.NET Core.
Video of the talk given at the DotNext conference https://www.horsdal-consult.dk/2018/05/talk-lightweight-microservice.html
4. INTRODUCTION TO MICROSERVICES
A MICROSERVICE IS A SERVICE WITH ONE, AND ONLY
ONE, VERY NARROWLY FOCUSED CAPABILITY THAT A
REMOTE API EXPOSES TO THE REST OF THE SYSTEM.
7. WHY NOT?
• DISTRIBUTED SYSTEMS ARE HARD
• 100S OR MORE SERVICES
COMPLEX PRODUCTION ENVIRONMENT
LOTS OF DEPLOYMENTS
• REFACTORING ACROSS SERVICES IS CUMBERSOME
21. EVENT FEED
• AN HTTP GET ENDPOINT
• SUPPORTS PAGING
• HTTP GET /EVENTS?FROM=100&TO=200
• EVENTS RAISED BY DOMAIN LOGIC
• EVENTS ARE STORED IN AN EVENT STORE
22. EXAMPLE: EVENT FEED
Get("/", _ =>
{
long firstEventSequenceNumber, lastEventSequenceNumber;
if (!long.TryParse(this.Request.Query.from.Value,
out firstEventSequenceNumber))
firstEventSequenceNumber = 0;
if (!long.TryParse(this.Request.Query.to.Value,
out lastEventSequenceNumber))
lastEventSequenceNumber = long.MaxValue;
return eventStore.GetEvents(firstEventSequenceNumber,
lastEventSequenceNumber);
});