Getting started with Pub/Sub Messaging in .NET

2022 ж. 21 Там.
41 023 Рет қаралды

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/Elfocrash/aws-videos
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/ChapsasGitHub
Follow me on Twitter: bit.ly/ChapsasTwitter
Connect on LinkedIn: bit.ly/ChapsasLinkedIn
Keep coding merch: keepcoding.shop
#dotnet #microservices #aws

Пікірлер
  • 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.

    @SlackwareNVM@SlackwareNVM Жыл бұрын
  • YES, please make a video about FIFO and the slution in a microservice worl

    @FarukLuki111@FarukLuki111 Жыл бұрын
  • Make one video for Channels in .NET (ChannelReader, ChannelWriter, BoundedChannel, etc.)

    @ivaniliev93@ivaniliev93 Жыл бұрын
    • Second this, an implementation comparison (comparing with MediatR and/or MassTransit, for example) would be very interesting.

      @AndreasRavnestad@AndreasRavnestad Жыл бұрын
    • Beside channels it would be also great to create some videos for TPL Dataflow and Akka.NET.

      @branislavpetrovic7486@branislavpetrovic7486 Жыл бұрын
    • @@branislavpetrovic7486 are people still using TPL?

      @ivaniliev93@ivaniliev93 Жыл бұрын
    • @@ivaniliev93 Ofcourse, TPL is siuted very well for parallel processing of CPU-bound work and I use it regularly on my projects.

      @branislavpetrovic7486@branislavpetrovic7486 Жыл бұрын
  • I would absolutely love to see more content like this.

    @kaydenmiller8156@kaydenmiller8156 Жыл бұрын
  • @4:20 Great plug Nick!

    @parlor3115@parlor3115 Жыл бұрын
  • Thank you for the great content you offer here Nick.

    @maltrkawi@maltrkawi Жыл бұрын
  • That's more of the Nick Chapsas, keep going forward!

    @speakoutloud7293@speakoutloud7293 Жыл бұрын
  • I can only recommend doing it like so! 🙂 Also the new developers I'm working with currently love it, too.

    @thegenxgamerguy6562@thegenxgamerguy6562 Жыл бұрын
  • Great video. Can't wait for more.

    @rade6063@rade6063 Жыл бұрын
  • 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.

    @mehdizeynalov1062@mehdizeynalov1062 Жыл бұрын
  • 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

    @dayv2005@dayv2005 Жыл бұрын
  • Thank you a lot! You helped me to become a good developer

    @oleksandrkurinovskyi3820@oleksandrkurinovskyi3820 Жыл бұрын
  • 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?

    @LacfY@LacfY Жыл бұрын
  • 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!

    @pmmaxnet@pmmaxnet Жыл бұрын
  • Great Video but the : Basket added in the item so funny :D

    @amineherizi4687@amineherizi4687 Жыл бұрын
  • 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

    @JunaidBedford@JunaidBedford Жыл бұрын
  • Hi Nick, are you not bothered by having to poll SQS for new messages? wouldn't an event driven option be preferable?

    @mattblock8802@mattblock8802 Жыл бұрын
  • 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?

    @dfytq@dfytq Жыл бұрын
  • Yes. We or at least I would like to know how you're not reading the past in the future without FIFO queue

    @dawizze1@dawizze1 Жыл бұрын
  • 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?

    @dubaiestate95@dubaiestate95 Жыл бұрын
    • It is if you care about throughput. Client side filtering will bottleneck your services. The subscriber is part of your service

      @nickchapsas@nickchapsas Жыл бұрын
    • ​@@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.

      @dubaiestate95@dubaiestate95 Жыл бұрын
  • Love the video, can you some content in dapr as well??

    @01mrsir@01mrsir Жыл бұрын
  • 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 ?

    @antonmartyniuk@antonmartyniuk Жыл бұрын
    • 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.

      @ianfoster6601@ianfoster66018 ай бұрын
  • Please do a video with the same scenario you described here, but with Azure PubSub Service, and compare it with the sns solution

    @ivanzinov6875@ivanzinov6875 Жыл бұрын
  • Put me down for wanting to hear what you do to handle message ordering when not using a FIFO queue.

    @calebvear7381@calebvear7381 Жыл бұрын
  • 18:18 nice

    @brandonhill9356@brandonhill9356 Жыл бұрын
  • 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

    @TheNeozas@TheNeozas Жыл бұрын
  • 420? 69? -- Nick's testing is based.

    @MindlessTurtle@MindlessTurtle Жыл бұрын
  • "Like you all hopefully" xDDDD

    @adrian_franczak@adrian_franczak Жыл бұрын
  • interesting choice of the lifeTimeSpent amount 😈

    @gordonfreimann@gordonfreimann Жыл бұрын
    • Showing up at the end of Alyx was a gigachad move. Keep it up Gordon

      @nickchapsas@nickchapsas Жыл бұрын
  • Looking forward to test this soon. AWS CREDIT #NICK

    @Otonium@Otonium Жыл бұрын
  • 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.

    @ahmedma527@ahmedma527 Жыл бұрын
    • I am not an expert in Java so I am not qualified to do such a thing

      @nickchapsas@nickchapsas Жыл бұрын
  • 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

    @idgafa@idgafa Жыл бұрын
    • 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.

      @nickchapsas@nickchapsas Жыл бұрын
  • 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.

    @JonathasSucupira@JonathasSucupira Жыл бұрын
    • I will follow this up with my AWS contact

      @nickchapsas@nickchapsas Жыл бұрын
  • Do you really need to restart the consumer after changing the rules (sub dfilter) in AWS?

    @FarukLuki111@FarukLuki111 Жыл бұрын
    • 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

      @nickchapsas@nickchapsas Жыл бұрын
  • Hi, i need ef core multiple provider/db.. anyone have references?

    @coding-in@coding-in Жыл бұрын
  • 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?

    @simonvandenhende5274@simonvandenhende5274 Жыл бұрын
    • 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.

      @nickchapsas@nickchapsas Жыл бұрын
  • 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.

    @maxpuissant2@maxpuissant2 Жыл бұрын
    • rabbitmq in docker

      @adrian_franczak@adrian_franczak Жыл бұрын
    • @@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.

      @maxpuissant2@maxpuissant2 Жыл бұрын
    • Redis has pub/sub, queues, db, etc

      @daniel_paez@daniel_paez Жыл бұрын
  • I normally enqueue from a database trigger

    Жыл бұрын
  • Don't want to nitpick but your whiteboard is actually a gray board. In which case it's actually called a blackboard.

    @ErikBongers@ErikBongers3 ай бұрын
  • Let's bring the white board, and literally brings a black board. Great content. Thank you

    @TheMohsell@TheMohsell Жыл бұрын
  • @Nick Chapsas makes a video about AWS, which means lots of AWS vs Azure comments are incoming.

    @Timlaare@Timlaare Жыл бұрын
  • Isn't that a blackboard?

    @ibrahimhussain3248@ibrahimhussain3248 Жыл бұрын
  • How about offline development?

    @xRealHackerx@xRealHackerx Жыл бұрын
    • You can use localstack for local development

      @nickchapsas@nickchapsas Жыл бұрын
  • Being new to this area, to understand slowly, I had to reduce playback speed to 0.75 .. you talk so fast :)

    @kaustubhap@kaustubhap Жыл бұрын
  • 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. 😊

    @petertoftager-larsen8532@petertoftager-larsen8532 Жыл бұрын
    • 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

      @nickchapsas@nickchapsas Жыл бұрын
  • Create a video for messages queues but this time using azure

    @jorgen7842@jorgen7842 Жыл бұрын
    • I already have that

      @nickchapsas@nickchapsas Жыл бұрын
  • AWS access policy/access control architecture is unnecessarily complicated...

    @WeijieJIN@WeijieJIN Жыл бұрын
    • "convenience is the enemy of security"

      @BrendonParker@BrendonParker Жыл бұрын
  • Make a good explanation, in your style, of SignarlR and Realtime in .NET

    @ayalamac@ayalamac Жыл бұрын
  • FIRST

    @snarklisnuppy8785@snarklisnuppy8785 Жыл бұрын
  • Have u ever explored dotnet orleans? That stuff looks neat but rarely spoken about.

    @CodeTalker23@CodeTalker23 Жыл бұрын
  • Hey Microsoft, take back MVP from that guy unless you did it already🙂

    @danku1013@danku1013 Жыл бұрын
    • More like, Microsoft start sponsoring some .NET content creators

      @nickchapsas@nickchapsas Жыл бұрын
KZhead