Тема доклада
Тема доклада
Тема доклада
KYIV 2019
Serhii Kalinets
Effective Microservice Communication
.NET CONFERENCE #1 IN UKRAINE
About Me
Here should be some text about me 
We are hiring!
XP Days
https://xpdays.com.ua/
November 22-23, 2019
Kyiv, Ukraine
.NET fwdays'20
https://fwdays.com/event/dotnet-fwdays-2020
April 11, 2020 Kyiv,
Ukraine
Kyiv ALT.NET
In the previous episode…
.NET Framework
IIS
SOAP / WSDL
WCF
New wonderful world of
microservices…
dotnet new
Representational
state transfer (REST)
RESTful
Client server architecture
Statelessness
Cacheability
Layered system
Uniform interface
REST: Uniform interface
Resource identification in requests
Resource manipulation through representations
Self-descriptive messages
Hypermedia as the engine of application state
(HATEOAS)
HATEOAS
https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
Is it really REST?
POST is used for updates and deletes
Changes in service require client to update
No HATEOAS
REST Problems
Not suitable for all domains
RPC is still a thing
Weak contracts (contrasting to WSDL)
Swagger and OpenAPI
Client generation
Auto-publishing to WIKI
OpenAPI Swagger
Tools
NSwag, Swashbuckle for API spec /
documentation
SwagerCodeGen for client generation
Consumer Driven Contracts
Allow to test
services and clients separately
Ensure that clients do not get
broken when service evolves
How it works
Consumer creates model and client
Consumer creates test against service mock
Result of test run is recorded as JSON file, called ”pact”
Service uses client stub takes that pact file and runs it
against actual service
gRPC
Strict contract between client and service
Backwards compatibility
Plumbing code is generated and is always
optimal
gRPC in .NET Core
dotnet new grps
Messaging
Asynchronous communication
Reliability is covered by a message broker
Events / commands architecture
https://www.confluent.io/blog/building-a-microservices-ecosystem-with-kafka-streams-and-ksql/
Event Streams and KSQL
KSQL is available only as Java / Scala
Use sidecar pattern
What is GraphQL
Queries
Mutations
(new hotness) Subscriptions
Pros of GraphQL
Control over bandwith
Authorization on field / operation level
Fewer repetitive endpoints
Cons of GraphQL
Not optimized for .NET
Polly
// Break the circuit after the specified number of consecutive
// exceptions and keep circuit broken for the specified
// duration.
Policy
.Handle<SomeExceptionType>()
.CircuitBreaker(2, TimeSpan.FromMinutes(1));
Service
Mesh
Conclusion
Important conclusion 1
Important conclusion 2
Important conclusion 3
Thanks!
kalinets@gmail.com
@skalinets

.NET Fest 2019. Сергей Калинец. Efficient Microservice Communication with .NET Core

Editor's Notes

  • #8 Можна забути, але знання можуть стати у пригоді, якщо емігруєте за кордон, або на галері (мабуть зараз хтось у залі всплакнув)