Getting started with Pub/Sub Messaging in .NET

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • Get $50 free AWS Credit by adding "AWS CREDIT #NICK" in the "Tell us about your project" area: bit.ly/nickaws
    Get the source code: github.com/Elf...
    Check out my courses: dometrain.com
    Become a Patreon and get source code access: / nickchapsas
    This video is sponsored by AWS
    Hello everybody I'm Nick and in this video I will show you how you can get started with Pub/Sub or Publisher Subscriber messaging in .NET. In this example we will be using AWS SNS and SQS but you can use everything you learn here with other messaging technologies too since the concept is fairly standardized.
    Don't forget to comment, like and subscribe :)
    Video on queues: • What is Azure Service ...
    Social Media:
    Follow me on GitHub: bit.ly/ChapsasG...
    Follow me on Twitter: bit.ly/ChapsasT...
    Connect on LinkedIn: bit.ly/ChapsasL...
    Keep coding merch: keepcoding.shop
    #dotnet #microservices #aws

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

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

    I'd love to see more in-depth videos on what it's like to work with messaging. For example, now that you're not awaiting synchronous calls, how do you detect errors in the system, how do you make sure not to end up with invalid state in one service when another fails, how do you aggregate the results of messages you've sent to be worked on in parallel, how different is it to design a microservice ecosystem using asynchronous messaging, etc.

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

    YES, please make a video about FIFO and the slution in a microservice worl

  • @ivaniliev93
    @ivaniliev93 2 года назад +33

    Make one video for Channels in .NET (ChannelReader, ChannelWriter, BoundedChannel, etc.)

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

      Second this, an implementation comparison (comparing with MediatR and/or MassTransit, for example) would be very interesting.

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

      Beside channels it would be also great to create some videos for TPL Dataflow and Akka.NET.

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

      @@branislavpetrovic7486 are people still using TPL?

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

      @@ivaniliev93 Ofcourse, TPL is siuted very well for parallel processing of CPU-bound work and I use it regularly on my projects.

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

    That's more of the Nick Chapsas, keep going forward!

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

    Thanks Nick, best aws content so far - the only thing missing is I now it's horrible, but if you could add the cdk logic to have all those roles added etc. we would have more time to watch world cup :) apart from joking thanks mate for excellent videos.

  • @user-rp9iis1en6h
    @user-rp9iis1en6h 2 года назад

    I got three questions for you,
    1. How does it ensures a published message is consumed by a consumer only once(consumer on same message for scalability reason)
    2. How does it ensures a published message is consumed by all consumer only once(consumer on same message for different different actions)
    3. How to ensure a distributed transaction among multiple consumers(so if a consumer fails, rollback all consumer's action), is there any design pattern for that?

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

    I would absolutely love to see more content like this.

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

    @4:20 Great plug Nick!

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

    Thank you for the great content you offer here Nick.

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

    I can only recommend doing it like so! 🙂
    Also the new developers I'm working with currently love it, too.

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

    420? 69? -- Nick's testing is based.

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

    Thank you a lot! You helped me to become a good developer

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

    Yes. We or at least I would like to know how you're not reading the past in the future without FIFO queue

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

    interesting choice of the lifeTimeSpent amount 😈

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

      Showing up at the end of Alyx was a gigachad move. Keep it up Gordon

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

    Love to see how you solved ordering with out a fifo queue. I'm doing something similar now by building state time checks to determine if the event is out of date. If it is, reject the event. Would love to see how you resolve it without fifo

  • @ErikBongers
    @ErikBongers 7 месяцев назад

    Don't want to nitpick but your whiteboard is actually a gray board. In which case it's actually called a blackboard.

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

    Hi Nick, this is a bit off topic. I looked for a video on this topic in your channel and couldn't find it. What is your view on Reactive Extensions (Rx.NET)? Is it something .NET developers should bother learning or can they, for the most part, ignore it and perhaps focus on other technologies (cloud, Pub/Sub, IAsyncEnumerable amongst others) which might accomplish the same thing in a different way? Thanks

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

    Hi Nick, are you not bothered by having to poll SQS for new messages? wouldn't an event driven option be preferable?

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

    Please do a video with the same scenario you described here, but with Azure PubSub Service, and compare it with the sns solution

  • @kaustubhap
    @kaustubhap 2 года назад +4

    Being new to this area, to understand slowly, I had to reduce playback speed to 0.75 .. you talk so fast :)

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

    Great Video but the : Basket added in the item so funny :D

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

    Put me down for wanting to hear what you do to handle message ordering when not using a FIFO queue.

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

    Really powerful tool and as all powerful tools it is a very easy to turn you project in untestable an undebuggable mess :) Every one how had met Flux/Redux/other inheritor applications would feel the pain, I believe. The only way to control this is the strong discipline inside the team, heh, because the "callback hell" can be met in all realisations of Pub/Sub, not only in Events, sadly

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

    Thanks for the video.
    I think it would be much better if the subscriber could define the filter expression in client side instead of we should create a pre-configured filtered queue in the AWS. Or is this possible?

  • @adrian_franczak
    @adrian_franczak 2 года назад +4

    "Like you all hopefully" xDDDD

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

    Hi Nick, great video as usual, 1q, how is this compared to Amazon EventBridge? is EventBridge an older solution, or a new one, is it a simple way to do SNS+SQS? how about performance, is the custom SNS+SQS better for high scalability or EventBridge is just the same? Thanks!

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

    Great video. Can't wait for more.

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

    Let's bring the white board, and literally brings a black board. Great content. Thank you

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

    18:18 nice

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

    Looking forward to test this soon. AWS CREDIT #NICK

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

    For example we have all databases, SQS, SNS etc environment setup on the dev AWS account and we need to create and setup all of the things in the customer's environment. Does AWS support import and export of these things ? Or you need to re-create all of it manually ?

    • @ianfoster6601
      @ianfoster6601 11 месяцев назад +1

      The tool you're looking for is called 'Cloudformation'. You can create a YAML file (or JSON file) that defines all the infrastructure you want in your environment and then tell AWS to create all your infrastructure from that file. This way you can re-create the same architecture multiple times. You can also parameterize it for variations between environments.

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

    Isn't that a blackboard?

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

    I was unable to get the $50 credit. The first message I got back from AWS said they didn't have enough context, so they asked for some more information. After I mentioned this promotion, they said that I needed to contact the sales team.

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

      I will follow this up with my AWS contact

  • @coding-in
    @coding-in 2 года назад

    Hi, i need ef core multiple provider/db.. anyone have references?

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

    Thanks for the video @Nick Chapsas I really appreciated.
    But I see a logic condition filter added into the AWS service. Is that a good practice in real life production apps?

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

      It is if you care about throughput. Client side filtering will bottleneck your services. The subscriber is part of your service

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

      ​@@nickchapsas Thanks for your reply.
      It is a valid point.
      But what if I wanted to move into Azure service bus or RabbitMQ implementation. It's not the same way of filtering for each technology.

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

    Can you please make a performance comparison between the C Family languages (C#, Java, etc...)? I am curious which is faster, C# or Java. Thanks.

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

      I am not an expert in Java so I am not qualified to do such a thing

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

    How can you do that without cloud services on a single server? Best way i know for now is to install Kafka in single node configuration but i'm still looking for something simpler.

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

      rabbitmq in docker

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

      @@adrian_franczak Kafka is in docker too, still not ideal to deploy on end user devices to communicate between front end winforms app to backend windows services.

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

      Redis has pub/sub, queues, db, etc

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

    Do you really need to restart the consumer after changing the rules (sub dfilter) in AWS?

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

      No you don’t. I just had to wait something like 5-7 minutes for the changes to propagate and in the meantime I stopped it

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

    Love the video, can you some content in dapr as well??

  •  2 года назад

    I normally enqueue from a database trigger

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

    How about offline development?

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

      You can use localstack for local development

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

    AWS access policy/access control architecture is unnecessarily complicated...

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

      "convenience is the enemy of security"

  • @petertoftager-larsen8532
    @petertoftager-larsen8532 2 года назад

    I’ve been doing this for a couple of years as well, but via Azure Service Bus. Different interface but same concept. One thing I really do not like in your example is the fact that you put all the attributes as metadata, In effect increasing your message size by double, an also making the raw content of the message obsolete. I know you can not filter on raw content, but this solution is not a good way to go. I would rather do the filtering in the subscriber instead, where the rest of your business logic would probably be located. Just my 2 cents. Thanks for your videos, learning a lot from them. 😊

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

      Subscriber based filtering destroys thoughput in both SQS and Azure Service Bus. You should have this responsibility on the topic level. You don't need to have the property as a message attribute if you don't need it, meaning you can reduce the payload drastically. There is publisher-consumer communication so if they need filtering on a property you can retroactively add it

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

    @Nick Chapsas makes a video about AWS, which means lots of AWS vs Azure comments are incoming.

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

    nice video again, Nick! I am wondering whether it would be more concise to create a topic per message. That way, a subscription would mean you are interested in that message. If you are not, you don't subscribe. It feels more comprehensive to link the handling of a message to the subscription. Not to the subscription + some filters that may or may not apply. How do you feel about this?

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

      One topic per message is a horrible convoluted approach. It is totally acceptable for subscriptions to have filters in pub/sub. It’s part of their design.

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

    Hey Nick, great content. Just curious, is it proper way of filtering events in SNS? the LifeTimeSpent >= 69 seems like BL code, no? also in term of testing this logic seems to be little harder to test and also you need to keep in mind that there is some filtering happening in SNS, when you dont receive some events in consumers. Thanks

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

      It is totally fine. You own the subscription while the publisher owns the topic. Technically you are leaking it from a DDD perspective but if you normally were listening on a high volume topic then this filtering is needed to ensure good performance. Ultimately I think it’s a balancing act. If performance is fine then keep it in the app. If you need even more then move it to the subscription as a filter.

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

    Create a video for messages queues but this time using azure

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

    Make a good explanation, in your style, of SignarlR and Realtime in .NET

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

    FIRST

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

    Hey Microsoft, take back MVP from that guy unless you did it already🙂

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

      More like, Microsoft start sponsoring some .NET content creators

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

    Have u ever explored dotnet orleans? That stuff looks neat but rarely spoken about.