Getting started with Queues in .NET using AWS SQS

Поделиться
HTML-код
  • Опубликовано: 18 янв 2025

Комментарии • 75

  • @7th_CAV_Trooper
    @7th_CAV_Trooper 2 года назад +4

    This is the best C# channel on RUclips x 10. Sometimes it's like Nick has access to my backlog and makes videos just for me.

  • @lucasteles42
    @lucasteles42 2 года назад +3

    A simpler way to have it working nice is with Mediatr, the background service does de parse and dispatch of the messages

  • @tntomek
    @tntomek 2 года назад +2

    Your channel is amazing. It's perfectly in-depth enough to lean and start doing. As requested, more AWS + .NET Architecture videos please.

  • @p4xx07
    @p4xx07 2 года назад +7

    I would like to see the covariance and contravariance one!

  • @ecoreyelias
    @ecoreyelias Год назад

    This is honestly my favorite video. So many good patterns and examples. Hats off.

  • @winstonstrongarm8929
    @winstonstrongarm8929 2 года назад +12

    Yesssssssss, been waiting for this, I've done a few implementations in my projects but I've never been fully happy with it. Would love to see more videos on proper async data pipelines/flows👍 thanks for doing these videos man, I dropped out in first year of my Cs degree and while I can code, I always feel lacking on the infrastructure/architecture side. Your courses and videos have been a massive help for me🙏

  • @mehdizeynalov1062
    @mehdizeynalov1062 2 года назад

    Nick your videos are just what is required, a true scientist... well done man.

  • @FarukLuki111
    @FarukLuki111 2 года назад

    I like the fact that your videos and Topics are getting "bigger" and more detailed! thx

  • @rafalschmidt1183
    @rafalschmidt1183 2 года назад +8

    I would love to see different techniques how to tackle idempotency! I've seen many different approaches and would be great to compare with what you've seen.

    • @alissonhonostorio
      @alissonhonostorio 2 года назад +1

      The message received by SQS has one property messageId and that id is unique no metter how many times this message is delivered, a simple way to deal with this idempotency is saving this Id

  • @evildoer1606
    @evildoer1606 2 года назад

    Yo Nick! I'm Xamarin dev that switched to backend half a year ago. Old viewer of yours, but now - your channel is a real GEM for me, every new video I watch is exactly what I need, just started my AWS journey and the timing of this one is magic. Thank you for your content! Also I really want to see a bonkers approach with Handlers and more AWS content overall.

    • @craigfranchuk9339
      @craigfranchuk9339 2 года назад

      I've been using this approach for processing messages via the azure service bus since generic host (background service) released in .net core 2.1. Thanks for producing these videos, I find the content very useful and practical.

  • @Vinoyl
    @Vinoyl 2 года назад

    I love how you're releasing these AWS videos a few months after I had to figure it all out myself lol

  • @pdevito
    @pdevito 2 года назад +2

    Cool video! I’d probably prefer to use a message bus like mass transit to abstract most of this out for me, but still fun to see it built too

  • @pedroh.franco
    @pedroh.franco 2 года назад

    Congratulations Nick, as always a good video.

  • @DanielAlvaradoB
    @DanielAlvaradoB 8 месяцев назад

    Eyy, this was super helpful and very easy to follow. Thank you! 🙏

  • @paulscarlett4346
    @paulscarlett4346 2 года назад

    Great info... having used MSMQ for over 10 years for Process Control.. nice to see a modern implementation of a message dispatcher

    • @q1joe
      @q1joe 2 года назад

      I mean even 10 years ago MSMQ wasn't "modern". Wondering why it was ever picked after 2008.

  • @euanmair55
    @euanmair55 2 года назад +1

    Hi Nick, great video as always. Is there any chance you could do a video on Amazon Cognito? i.e. basic setup and walkthrough

  • @sunsei104
    @sunsei104 2 года назад

    Can't wait for the architecture video ! Keep up the good work !

  • @yonatandaniyel5640
    @yonatandaniyel5640 Год назад

    Great video and pretty slick use of reflection to handle registering your services in the service container. Do you have a video that would utilize SNS and also display how the messages are deleted from the Queue? Also, would be nice to see the use of the DLQ for failed messages.

  • @SlackwareNVM
    @SlackwareNVM 2 года назад +1

    I'd love to see a video for the generic message handling. That scenario comes up way too often.

  • @Daanik8
    @Daanik8 2 года назад

    Hey Nick, great video! Thank you bringing such quality content!

  • @timothywestern6488
    @timothywestern6488 2 года назад

    So this is a fascinating idea.
    The way you described Standard AWS QUeue sounds like a prioritized asynchronous queue.
    I can imagine a queue where all of these items are waiting to be processed, and as product becomes available it can be filled by the first order that asks for it, maybe.
    But its potentially optimizable because if you have someone in slot 3 asking for grapes, but slot 2 wants grapes and pomegranates but the pomegranets are delayed (and maybe you optimize to try to fill what you can complete, and if it ends up getting stuck then getting intervention somehow to break the queued item up. AWS could optimize to look for the first item in the queue that can be filled and dispatched. So I think I really like this idea, because its not like you have competing tasks waiting to be filled and potential contention that way. Pretty cool!

  • @emmanueladebiyi2109
    @emmanueladebiyi2109 Год назад

    Looks like you ended up not using the static abstract interface members feature as the reflection scanning would work regardless. Right?

  • @iamaashishpatel
    @iamaashishpatel 2 года назад

    As usual, awesome content. 🙏

  • @Fran-bo7vg
    @Fran-bo7vg Год назад

    Can one use NServicebus with SQS and not worry about implementing a custom dispatcher logic?

  • @ThiNguyen-bm5ln
    @ThiNguyen-bm5ln 9 месяцев назад

    Hey Nick. Thanks for the video. I have a question though. If the published message is subscribed by multiple applications (or I can say users), how do we make sure all the users see the message before it gets deleted? (If we don't delete the message, one user might end up seeing the message multiple times)

  • @xieweiling7543
    @xieweiling7543 2 года назад

    Awesome video, although the last part 'Automatic registration refactoring' is a little bit hard and rush.

  • @m1kecrosoft
    @m1kecrosoft 2 года назад

    I tried to run this project in dotnet 7 but it fails because IMessageHandler can be used as a type. Then I downgrade to dotnet 6 but I can use abstract in the property IMessageHandler.MessageType so I have to initialize that property with typeof(IMessageHandler), it is good ?

  • @wh33lers
    @wh33lers 2 года назад

    Thanks for sharing all those details. I am also using SQS very intensively and love the service for its simplicity. Keep it up

  • @jamesevans6438
    @jamesevans6438 2 года назад

    Hey Nick, awesome video, thanks so much for the great content and for sharing. Would be interested in how to deal with idempotency too. Looking forward to the solution architecture video too.

  • @kazepis
    @kazepis 2 года назад

    Really nice video! Congrats! And as always, keep them coming… 🎉

  • @crazyfox55
    @crazyfox55 2 года назад

    Your comment about the messages being in a shared project instead of duplicating the files is a good one. However when you used the executing assembly it will not find those messages, instead typeof(IMessage).Assembly would be better. Same concept for the IMessageHandler.

    • @nickchapsas
      @nickchapsas  2 года назад +2

      Yeah I did mention that you would use a type or an assembly if you had it in a separate project

    • @crazyfox55
      @crazyfox55 2 года назад +1

      @@nickchapsas Now that I think about it more, like you said most developers would have understood to use typeof(IMessage) instead of typeof(Program) if they moved the files to a separate project.

  • @Couper44
    @Couper44 2 года назад

    Hey Nick, great video, please do more about queues and how to efficiently publish/consume messages 🙏.
    Kind of unrelated, but it would make sense to put together handler's registration and populating MessageDispatcher's dictionaries? (to avoid forgetting registering them in Program.cs)
    Many thanks!

    • @jfpinero
      @jfpinero 2 года назад

      No need for dictionaries, just use something like Scrutor to automatically register stuff

  • @xMsDanielx
    @xMsDanielx 2 года назад

    Hi Nick. Maybe in the near future you could create video about SAGAs?

  • @benjaminweber2598
    @benjaminweber2598 2 года назад

    Hi Nick! Do you use Azure (in this case the service bus) as well and can you make a comparison, or are you only on AWS?

    • @nickchapsas
      @nickchapsas  2 года назад

      I’ve used both in high scale production environments for 3 years each and I prefer AWS.

    • @benjaminweber2598
      @benjaminweber2598 2 года назад +1

      @@nickchapsas interesting, i would love to see a video about the reasons some day :)

  • @davidheale6435
    @davidheale6435 2 года назад

    Hey Nick, you don't have a link in the description below for Queues.

  • @shoooozzzz
    @shoooozzzz Год назад

    Did you just write your own MediatR? =)

  • @johncerpa3782
    @johncerpa3782 2 года назад +1

    Great video, reduce font size please

  • @regeface
    @regeface 2 года назад

    Very nice video. Any chance of making a similar vid with MassTransit?

    • @nickchapsas
      @nickchapsas  2 года назад +2

      I plan to make an expansion on this video to show how MassTransit can make all this better

  • @01mrsir
    @01mrsir 2 года назад +2

    Great vid bro... can you do some on Dapr?

  • @ksysio0o
    @ksysio0o 2 года назад

    Amazing content and great explanations. But for a more pleasant reception, I would advise 10% slower. It isn't a chase :).

  • @NameSurname-zm7gl
    @NameSurname-zm7gl 2 года назад

    heh, I decided to implement MessageDispatcher with generics, and it was the worse decision for the last few days) Could you please make a video\another branch in github with implementation in the way with generics/variance stuff.

    • @nickchapsas
      @nickchapsas  2 года назад +1

      I’m planning to use this example in a future video to explain the runtime problems (which you probably encountered), variance and alternatives

    • @NameSurname-zm7gl
      @NameSurname-zm7gl 2 года назад

      @@nickchapsas That would be awesome. Thanks

  • @anandjaisy
    @anandjaisy 2 года назад

    Hey mate, your videos are so useful, can you please make a video on comparison between Entity Framework latest vs Dapper. Why we should use dapper over entity framework and use cases.

  • @amrosamy8232
    @amrosamy8232 2 года назад

    For the dispatcher, I'd create an IEnumerable
    IMessageHandler can contains
    {
    string Command {get => nameof(MessageType)}
    Type MessageType {get;}
    Task HandleAsync ();
    }
    Then register all handlers as IMessageHandler
    Finally inject IEnumerable in the constructor
    Using linq
    var handlers = msgHandlers.Where(mh => mh.Command == input.commans )
    foreach(var handler in handlers) await handler.HandleAsync(input.Data);

    • @nickchapsas
      @nickchapsas  2 года назад +2

      This approach is problematic because it instantiates all handlers to just use one. waste of speed and memory

    • @amrosamy8232
      @amrosamy8232 2 года назад

      Make sense, that's why you created a dictionary

    • @DarraghJones
      @DarraghJones 2 года назад +1

      Unnecessarily instantiating handlers aside, i like this approach. I would probably introduce an abstract base class like this:
      public abstract class MessageHandler : IMessageHandler where TMessage : IMessage
      {
      public async Task HandleAsync(IMessage message)
      {
      if (messageis TMessage m)
      {
      await DoHandleAsync(m);
      }
      }
      protected abstract Task DoHandleAsync(TMessage m);
      }
      so my MessageDispatcher is nice a simple like this:
      public class MessageDispatcher
      {
      private readonly IServiceScopeFactory scopeFactory;
      public MessageDispatcher(IServiceScopeFactory scopeFactory)
      {
      this.scopeFactory = scopeFactory;
      }
      public async Task Dispatch(IMessage m)
      {
      using var scope = scopeFactory.CreateScope();
      foreach (var handler in scope.ServiceProvider.GetServices())
      {
      await handler.HandleAsync(m);
      }
      }
      }
      This way you can also write handlers which work off a base message type for instance:
      public class AllMessagesHandler : MessageHandler
      {
      protected override Task DoHandleAsync(IMessage m)
      {
      Console.WriteLine(m.GetType());
      return Task.CompletedTask;
      }
      }

  • @ali_randomNumberHere
    @ali_randomNumberHere 2 года назад

    sadly we cant use aws services in iran,thats just make me feel depressed

  • @nishadhkhan974
    @nishadhkhan974 2 года назад

    @Nick Chapas, How can i rate limit a specific api which url contains and require int value.
    E.g
    api/account/details - This is like you explained - which is working
    but what in case if url is like this?
    api/account/{accountId:int}/details
    Please help me. im using webapi2

  • @metaltyphoon
    @metaltyphoon 2 года назад +3

    I never understand the obsession with adding `Async` to methods where you don't provide a sync version of it. It's just fluff. Everyone knows a task can be awaited

    • @nickchapsas
      @nickchapsas  2 года назад +2

      Then in the code that you write you should definitely not use that suffix

    • @metaltyphoon
      @metaltyphoon 2 года назад

      @@nickchapsas I definitely don’t. In fact calling it Async may be a lie. See MemoryStream for example. I also don’t add access modifiers just because; only when necessary.

    • @metaltyphoon
      @metaltyphoon 2 года назад

      @@ShiyalaKohny To clarify, I never meant to be rude and if that’s how it came across, I want you to know it wasn’t the case @Nick Chapsas.

    • @metaltyphoon
      @metaltyphoon 2 года назад

      @@paulkoopmans4620 Microsoft don’t even follow their own conventions on their asp code base 😂. Async is just noise as is typing private for private members.

    • @paulkoopmans4620
      @paulkoopmans4620 2 года назад

      ​@@metaltyphoonnot sure which occurrences you are thinking of at this moment. But... no framework and/or programming is ever 100% correct. That does not mean however that "standards" and trying to follow them is bad. Quite the opposite IMHO.
      I will admit that I come back to my code at times thinking... wt... why did I just not follow the coding style guide or why I not do this or that. But I am a human and so are they.
      But if nothing would have existed at all.... oh boy... I can just imagine how terrible that must be. Property names will all kinds of different casing. Terrible method names like b_convstr() instead of TryConvertString(), just because, you know. No!!! No!!! No!!! Even though never perfect, millions of developers following a "standard" is better than nothing.
      And again; I personally believe in intent of code. If a member is a private member it should be marked as such. If it were up to me I would say the implicit access modifier behaviour should have never existed. It serves no purpose! the "choice" of private as the default access modifier is as terrible of a choice as any of the other ones.
      My classes are usually sprinkled with lots of public methods, public properties, protected, etc, as well. I think I may usually have more of any of the other ones than private. Maybe public should have been the default :).

  • @IsaacOjeda
    @IsaacOjeda 2 года назад

    👏🏽👏🏽👏🏽👏🏽👏🏽

  • @Ristogod
    @Ristogod 2 года назад +2

    Yeah, get on AWS, so they can turn you off if you have the "wrong ideas". No thanks.

    • @marcinpawelw
      @marcinpawelw 2 года назад +1

      While I agree with you, I believe that regular developers don't need to worry about it as much as our clients - they're the ones that amazon might refuse service. We can only advise them not to use services from providers who might be unreliable like that.

    • @maskettaman1488
      @maskettaman1488 2 года назад

      @@marcinpawelw The problem arises when it's your own AWS-backed service that a client is using. They can wrongthink your entire service in to the ground. Not a liability I want to take on

  • @NameSurname-zm7gl
    @NameSurname-zm7gl 2 года назад

    5:13 Am I only one person who expected a random id as 69

  • @massaynus
    @massaynus 2 года назад

    god forbid any poor soul has to write such C#

  • @emanuelcordovamontiel1017
    @emanuelcordovamontiel1017 9 месяцев назад

    I like your videos but you speak so fast. Could you speak more slowly, please?