Upgrade to Pro — share decks privately, control downloads, hide ads and more …

.NET Microservices

.NET Microservices

Spencer Schneidenbach

August 08, 2022
Tweet

More Decks by Spencer Schneidenbach

Other Decks in Programming

Transcript

  1. @schneidenbach I have lots of tools to help in this

    regard • Code reviews • Expectation setting with clients • CypressJS (for automated testing) • And, to some degree, microservices
  2. @schneidenbach We got things to talk about • What are

    microservices? • What’s the good/bad/ugly? • What does “the .NET” have? (Azure? AWS?)
  3. @schneidenbach Loosely coupled Two systems are loosely coupled if changes

    to the design, implementation, or behavior in one won't cause changes in another. https://www.capitalone.com/tech/software-engineering/how-to-avoid-loose-coupled- microservices
  4. @schneidenbach Requirements • Decoupled from main app for rapid, iterative

    release • If main app went down (it did sometimes) make sure it would get message later • Push text noti fi cations to employees to ensure timely response
  5. @schneidenbach Microservice communication • Message bus to carry events/commands •

    Use pointers and then provide HTTP endpoints to get data later
  6. @schneidenbach Requirements • Decoupled from main app for rapid, iterative

    release • If main app went down (it did sometimes) make sure it would get message later • Push text noti fi cations to employees to ensure timely response
  7. @schneidenbach Oftentimes, microservices is a good pattern to break off

    a piece that is particularly tricky for some reason or another (reliability, performance, etc.)
  8. @schneidenbach Examples • Azure Function - https://docs.microsoft.com/en-us/azure/ azure-functions/functions-bindings-service-bus-trigger • AWS

    Lambda Quick Hits - https:// nodogmablog.bryanhogan.net/2022/04/net-6-on-aws- lambda-quick-demos/
  9. @schneidenbach Three major choices • Write your own queue readers

    and processors • Use a free library, MassTransit • Use a not-so-free library, NServiceBus
  10. @schneidenbach I recommend MassTransit or NServiceBus • That said, if

    you’re new to service-based architectures, be prepared to read their docs a lot and copy/paste sample code.
  11. @schneidenbach NServiceBus pros • Enterprise-focused • Amazing support team •

    Lots of other tooling that comes with the NServiceBus system (for monitoring, etc)
  12. @schneidenbach MassTransit pros • Free and open source • Decent

    support, but no centralized support (basically, Google, StackOver fl ow, samples, and their Discord channel)
  13. @schneidenbach public class SendEmail { public string From { get;

    set; } public string To { get; set; } //other stuff public Attachment Attachment { get; set; } }
  14. @schneidenbach public class SendEmailV2 { public string From { get;

    set; } public string To { get; set; } //other stuff public Attachment[] Attachments { get; set; } }
  15. @schneidenbach API Gateway • Management tool between client and published

    APIs • Often handles authentication, documentation, rate limiting, etc.
  16. @schneidenbach Client of mine • Startup in a speci fi

    c vertical • They process a lot of fi les that get sent to them
  17. @schneidenbach Advantages • Used all of the Azure bits •

    Storage queues for messages and fi le storage • Event Grid to listen for incoming fi les • Azure SQL for, well, stu ff you’d put in a database • Easy-ish to monitor using Application Insights
  18. @schneidenbach Problems • Reached limits on the database • Reached

    execution limits on Azure Functions - oh and it got really ‘spensive