Build Clean Messaging in .NET with MassTransit

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ย. 2024
  • Enroll to "Cloud Fundamentals: AWS Services for C# Developers" for FREE: bit.ly/3XKUBOH
    Become a Patreon and get source code access: / nickchapsas
    Hello everybody I'm Nick and in this video, I will show you how you can get started with building clean and scalable messaging applications using the excellent library, MassTransit.
    Give MassTransit a star on GitHub: github.com/Mas...
    To get $25 worth of free AWS credits email dotnet-on-aws-feedback[at]amazon[dot]com with the subject line "AWS CREDIT NICK CHAPSAS".
    Workshops: bit.ly/nickwor...
    This video is sponsored by AWS
    Don't forget to comment, like and subscribe :)
    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
    #csharp #dotnet #aws

ความคิดเห็น • 159

  • @PhatBoyG
    @PhatBoyG ปีที่แล้ว +180

    Awesome video! So many details covered, including switching transports, the difference between IPublishEndpoint and IBus, ensuring contracts are in a namespace, and changing brokers - really amazing. Fantastic work, thanks for the great content!

    • @nickchapsas
      @nickchapsas  ปีที่แล้ว +43

      Thank YOU for the great library Chris! So much more to cover in future videos.

    • @wormB1
      @wormB1 ปีที่แล้ว +1

      @PhatBoyG hi Chris can you post docs of the configuration to use existing queues/topics that are created upfront by let’s say DevOps crew, regardless of the transport specific implementation (or ASB to be more precise)?

    • @sp2502
      @sp2502 ปีที่แล้ว +1

      @@nickchapsas MultiBus would be good to cover.

    • @GavSaysPogMoThoin
      @GavSaysPogMoThoin ปีที่แล้ว +5

      @PhatBoyG @nickchapsas How about you both partner up for a series of videos covering MT and some of the more advanced concepts like Routing Slips and Sagas? Nick has a knack for making the complicated things simple, which I think the MT docs really need.

    • @GuilhermeCardoso-td8qu
      @GuilhermeCardoso-td8qu ปีที่แล้ว

      You've alreays recommend to use Interfaces instead of classes to define the messas. Does the same applies with records, like Nick used here?

  • @sunefred
    @sunefred ปีที่แล้ว +131

    Yes please, a series on Sagas. Preferably with a mix of REST, database, and maybe other integrations.

    • @weifengmao
      @weifengmao ปีที่แล้ว +3

      You are asking for a full on state machine course. Chris (MT author) has plenty of them in his channel.

    • @bardin08
      @bardin08 ปีที่แล้ว +1

      @@weifengmao perfect! Thanks for the recommendation!

    • @michaelnjensen
      @michaelnjensen ปีที่แล้ว +2

      @@weifengmao What is his channel?

    • @vitovondervollbart1620
      @vitovondervollbart1620 ปีที่แล้ว +2

      Would love to see @nickchapsas's take on these topics. Sagas, yes please! Activities and routing slips, yes please! Outbox pattern, yes please! BTW, very thorough playlists here from Chris Patterson aka @PhatBoyG right here 👉 www.youtube.com/@PhatBoyG/playlists

    • @weifengmao
      @weifengmao ปีที่แล้ว

      @@michaelnjensen www.youtube.com/@phatboyg

  • @tonystoynev7969
    @tonystoynev7969 ปีที่แล้ว +91

    Hey, @Nick! It will be great if you make a video explaining the concept of Sagas! There aren’t many out there and I believe yours will be the best

  • @pablocom
    @pablocom ปีที่แล้ว +27

    I would LOVE to see more videos about Masstransit ❤

  • @devmarkmonster
    @devmarkmonster ปีที่แล้ว +5

    Wow, nice work! I’ve been using MassTransit for about 5 years now and would not have thought anyone could cover so much of MassTransit in such a condensed form.

  • @ivandrofly
    @ivandrofly 5 หลายเดือนก่อน +1

    11:59 - Very good point :) (no leaking domain model)
    13:49 - Referring to the Outbox or Transactional Outbox Pattern
    14:23 - Consumer project

  • @nickpolyderopoulos3491
    @nickpolyderopoulos3491 ปีที่แล้ว +4

    I wanted a video like that Nick. I am using MassTransit for the last couple of years at work and I wanted an easy way to explain it to the new developers. Now your video will help with that :)

  • @lyndseypaxton3697
    @lyndseypaxton3697 ปีที่แล้ว +11

    Great video, as usual. Would indeed love to see more details around sagas

  • @pilotboba
    @pilotboba ปีที่แล้ว +3

    @Nick Lots of stuff to parse in here.
    A few questions. What what you showed the same if there is a single consumer or multiple consumers? If multiple, which consumer is responsible for removing the message from the queue?
    Also, is it a common best practice to have a single queue for message type? At our shop, it seems more common to have one queue and multiple message types go through the queue.
    Also, I'd love to see some explanation of when to use SNS vs SQS and when and why to use them together.

  • @mediaatul
    @mediaatul ปีที่แล้ว +19

    Hi @Nick,
    i've been following you for long time, and learned lot from your videos, it helps me lot in enhancing my skills and career, do you mind creating one video series in Distributed transaction in Microservices.

    • @nickchapsas
      @nickchapsas  ปีที่แล้ว +16

      Great topic! I'll add it in the list

    • @mediaatul
      @mediaatul ปีที่แล้ว +1

      @@nickchapsas Thanks Nick 😊

  • @rholdorf
    @rholdorf ปีที่แล้ว +2

    Yes, please do some Saga state machine content. It would be nice to have your take on that. Chris’ videos are good but I think the community will love to see you explaining things.

  • @inzyster
    @inzyster ปีที่แล้ว +1

    I’ve been using MassTransit for a bit over 2 years now and seeing how awesome this video was I would love to see you talk about Sagas.

  • @jrqv
    @jrqv ปีที่แล้ว +5

    Excellent video Nick! And yes please make videos about those more advanced concepts, resilience best practices especially

  • @user-ht3cx2uz2w
    @user-ht3cx2uz2w ปีที่แล้ว +2

    This guy rocks! Thank you for the great video. Loads of details, so clearly explained.

  • @user-sq7ry5vx7t
    @user-sq7ry5vx7t ปีที่แล้ว +2

    I was searching for exactly this video like a month ago, it would have saved me many hours of love cast and documentation dive around some core concepts. But the documentation is so nicely written that it would be a shame to not have read it. Alas, this is awesome and I hope more content is produced around MassTransit (beside Chris Patterson own content, which is awesome but if the only person talking about a library is its own creator people may be more cautious to adopt).

  • @DoronGrinzaig
    @DoronGrinzaig ปีที่แล้ว +1

    The "well documented" in the intro. Man... You gotta be kidding me!
    Just stumbled on this video after spending a couple of hours of reading the source code because I could not find anything useful in the docs.
    It's a very useful library for sure and hats off to its creator and maintainers, but it has a lot of work to do on the documentation side.

  • @bardin08
    @bardin08 ปีที่แล้ว +3

    Awesome into to MassTransit, but we need a second (advanced) part where Sags and other advanced features of MassTransit

  • @eagleinthesky9777
    @eagleinthesky9777 ปีที่แล้ว +3

    Thank you for the great video!
    MassTransit is definitely great library and we used it on some small projects, but unfortunately it did not support configuration to work without admin permissions so we could not use it for big project that required infrastructure as a code approach.
    It always required connection string with admin permissions and wanted to modify infrastructure, create queues, read all available queues, etc...
    We needed something that just works with send and receive permissions and nothing more.
    Maybe it is possible now, but it was not possible in previous versions.

  • @jameshancock
    @jameshancock ปีที่แล้ว +4

    Sagas and Resilience, yes please!

  • @robertkhou
    @robertkhou ปีที่แล้ว +2

    Many years ago I used MassTransit but I have since replaced it with Dapr, Dapr is great!

  • @claudiovalerio7253
    @claudiovalerio7253 ปีที่แล้ว +1

    Great video as usual! Other videos about sagas and other messaging concepts will be extremely appreciated!

  • @YiannisMiliaresis
    @YiannisMiliaresis ปีที่แล้ว +1

    Μπράβο Nick, thank you for this video !

  • @phennexion
    @phennexion ปีที่แล้ว

    Not sure if it was intentional but you explained things well enough for dummies like me to understand the basics this time around and I appreciate that!! lol

  • @SlackwareNVM
    @SlackwareNVM ปีที่แล้ว

    Resilience has been a hot topic at our workplace. I'd love to see more videos on that.

  • @leonardomoreno23
    @leonardomoreno23 ปีที่แล้ว +1

    Saga is always a hot topic. Can't wait to watch it

  • @dudelkt
    @dudelkt ปีที่แล้ว +1

    Awesome video as always!!!
    I've been using MassTransit for the last couple of years and it's have been a great experience overall. I would like to learn more about Sagas too :)

  • @coolmn786
    @coolmn786 ปีที่แล้ว

    Love your timing. Thinking of using queues for a side project and doom! Video about it. Please do continue this series

  • @GiovanniOrlandoi7
    @GiovanniOrlandoi7 ปีที่แล้ว +2

    Thanks for the video! Would like to learn more about Sagas and Masstransit

  • @luludahora
    @luludahora ปีที่แล้ว +2

    Awesome content, Nick! A sagas video would be nice. Also, what do you think about showing us how to add a unit of work with mass transit? Thanks

  • @atomicazure
    @atomicazure 8 หลายเดือนก่อน

    Thank you Nick. I learnt Masstransit from you.

  • @orthodox-4-ever
    @orthodox-4-ever ปีที่แล้ว +3

    We want Sagas! 🥳

  • @michaelnjensen
    @michaelnjensen ปีที่แล้ว

    Definitely interested in more on masstransit, with sagas, statemachines, handling transactions etc, would even buy a course on it, along with many other more in-depth topics used for more complex enterprise/microservice solutions.

  • @steve-wright-uk
    @steve-wright-uk ปีที่แล้ว

    Great video. Would love to see more about sagas, and also about publishing a single message that get consumed by many consumers.

  • @robertlofthouse9667
    @robertlofthouse9667 ปีที่แล้ว +2

    Awesome video as always Nick. A MassTransit series that covers sagas and resilience would be great, thanks very much

  • @nove1398
    @nove1398 ปีที่แล้ว +1

    Yes looking out for a video on sagas

  • @childeroftheatom
    @childeroftheatom ปีที่แล้ว +1

    I love masstransit but I prefer to use Bustr because it is an abstraction on top of it to make it simpler to scale and more organized

  • @denizcanaltun
    @denizcanaltun 7 หลายเดือนก่อน

    Awesome! Thanks Nick

  • @BloodXlll
    @BloodXlll ปีที่แล้ว

    That would be great to learn more about the sagas!

  • @kirillhorn3186
    @kirillhorn3186 ปีที่แล้ว

    Yeah, definitely want a video about sagas and ither stuff!

  • @travusb
    @travusb ปีที่แล้ว

    I've been looking at MassTransit for a while for a rewrite of our code base and would love to see a series on it.

  • @vasiliyfofanov2605
    @vasiliyfofanov2605 ปีที่แล้ว

    Thanks a lot for the video. Waiting for Sagas video

  • @rcamine
    @rcamine ปีที่แล้ว

    a series about contract testing would be cool

  • @FlippieCoetser
    @FlippieCoetser ปีที่แล้ว

    Yes, please do a video on Saga and while you are at it throw Azure Pub-Sub in the mix.

  • @SamFerree
    @SamFerree ปีที่แล้ว +1

    thoughts on Rebus? I have nothing but the highest praise for it.

  • @bbatchelder
    @bbatchelder ปีที่แล้ว

    Yes to Sagas and Resilience!

  • @Chorniyko
    @Chorniyko ปีที่แล้ว

    Saga related video would be highly appreciated 😀

  • @queenstownswords
    @queenstownswords ปีที่แล้ว

    Nick, great Video. Please give insights on how you would test this (unit and integration). Thanks!

  • @BTimelessC
    @BTimelessC ปีที่แล้ว

    Definitely want a video on sagas :P Amazing videos as always. Could mass transit add different messaging implementations (RabbitMq, Azure Service Bus, AWS) for different consumers I wonder? I think it might, something about that ConfigureEndpoints method

  • @torrvic1156
    @torrvic1156 6 หลายเดือนก่อน

    Hello Nick! :)
    Great lesson indeed. Really want to see your video on SAGAS. But please slow down a bit. You are super fast and I am a bit slow 😂

  • @cordsac8107
    @cordsac8107 5 หลายเดือนก่อน

    Please do some complete tutorial for handling notification service with MassTransit + Hangfire or Quartz.

  • @martinmikhail
    @martinmikhail ปีที่แล้ว

    Nick, you are amazing and everyone thinks I'm a genius because I watch your videos. I have an app that writes to a DB however, the DB it taken down a number of times a month for maintenance. I was thinking of adding an internal que for resilience. Is that the correct answer?

  • @kir2154
    @kir2154 ปีที่แล้ว

    It would be perfect to know sagas concepts!

  • @alexisfibonacci
    @alexisfibonacci ปีที่แล้ว

    Yes please! Sagas!

  • @logantcooper6
    @logantcooper6 ปีที่แล้ว

    MassTransit has a transactional outbox as well.

  • @dcernach
    @dcernach 11 หลายเดือนก่อน

    Great content as usual! Brig us a video about Sagas using Masstransit and RabbitMq!

  • @sonics5439
    @sonics5439 ปีที่แล้ว +2

    Hi Nick, what is your recommendation on how to address problem when DB operation succeeds but publish message operation times out or fails in general? The only option I see is to use DB transaction which would be committed after publish operation succeeds but would like to know your opinion. Thanks!

    • @zholinho
      @zholinho ปีที่แล้ว +1

      I am using database as a queue. So when I do SaveChanges() everything or nothing will be saved.

  • @alessandrorodiani6651
    @alessandrorodiani6651 9 หลายเดือนก่อน

    More on MassTransit and sagass

  • @rezaabolhasanzadeh6845
    @rezaabolhasanzadeh6845 ปีที่แล้ว

    Tnx Nick
    Please create a complete tutorial on implementing saga pattern using masstransit

  • @codesafariDev
    @codesafariDev ปีที่แล้ว

    Hey Nick, great video - as always!
    I could not find a video about Hot Chocolate in your history, did you ever give it a try?

  • @eshadow2980
    @eshadow2980 ปีที่แล้ว

    Awesome video, thank you!
    Can you make video for more advance feature like consuming messages in multiple instances using round-robin and how handle in case of one instance failed to process the message after consuming (retries, redelivery to next instance) ?

  • @tahat4tt631
    @tahat4tt631 ปีที่แล้ว

    Hi nick, Can you please explain more about sages and activities? 15:37

  • @Andy01010
    @Andy01010 ปีที่แล้ว

    Yes please, make more videos 😎

  • @thomasgunther8249
    @thomasgunther8249 ปีที่แล้ว +2

    Hi Nick great video as always! I just started looking into MassTransit. I have two separate apps (no IPC) that are supposed to exchange simple messages with each other. The whole thing must work offline (so no AWS & Co.). RabbitMQ is a bit overkill. I thought of the GrpcProvider, which is also available for MassTransit. Do you think that could work? 🙂🤟👍

    • @aliengarden
      @aliengarden ปีที่แล้ว +1

      I'm having the same question. What did you end up using?

  • @MXDMND_
    @MXDMND_ ปีที่แล้ว

    Hey Nick, I am intrested in the Saga video as well. Thank you 😊

  • @paulkeating9259
    @paulkeating9259 ปีที่แล้ว

    Would love to hear your take on Sagas be it on here or dometrain

  • @FilipFranik
    @FilipFranik ปีที่แล้ว

    Just now I'm trying (and failing) to setup some end-to-end tests with MassTransit and WebApplicationFactory!

  • @GavSaysPogMoThoin
    @GavSaysPogMoThoin ปีที่แล้ว

    Another request for routing slips / sagas.

  • @yapadubpadoo
    @yapadubpadoo 2 หลายเดือนก่อน

    Thanks for sharing

  • @reniersantanderyhanes6750
    @reniersantanderyhanes6750 7 หลายเดือนก่อน

    Thanks!

  • @christpetitjean
    @christpetitjean ปีที่แล้ว

    Hello Nick, did you already looked at Dapr ? If so, what are your thoughts?

  • @pavelromashuk237
    @pavelromashuk237 ปีที่แล้ว +1

    Hi Nick. Thank you for the video. I am not so familiar with AWS, but with Azure. In Azure service bus there is an option to create a filters on the topic by subscription. May you know if masstransit supports it? It would be cool if you could make a video about it. Thank you.

  • @farzadmf
    @farzadmf ปีที่แล้ว

    SUPER cool!

  • @amirhossein6674
    @amirhossein6674 ปีที่แล้ว

    Fantastic video.

  • @aymaneeljahrani2280
    @aymaneeljahrani2280 9 วันที่ผ่านมา

    What if you want to share the contracts over multiple projects ?
    Would maintain it as a git repo and keep it in sync over these projects ?
    If not what would have you done ?

  • @RMarjanovic
    @RMarjanovic ปีที่แล้ว +2

    Hey Nick and thanks for a great video. When testing out MassTransit in my own projects I'm faced with the issue that topics / endpoints get created based on the namespace name. Which means that the consumer and publisher needs to share the same namespace on the message being sent. If I don't want to create a separate class library for the messages, nor sharing the same namespace name between different projects, is there a way to configure this more granularly in the setup?

    • @BTimelessC
      @BTimelessC ปีที่แล้ว +2

      Yes there is, you can configure your own topic/queue names. For example in azure service bus you can do it like :
      cfg.Message(m => m.SetEntityName("topic-name"));

    • @Divus90
      @Divus90 ปีที่แล้ว +1

      As mentioned by BTimelessC, you can set both queue and subscription names (not sure how to handle that with topic) on your own.

    • @eagleinthesky9777
      @eagleinthesky9777 ปีที่แล้ว +1

      There are replies in this thread how to configure custom topic name, you can try to set subscription name as well but unfortunately it will not work if classes are in different namespaces. It looks like strict requirement of the library that namespace and class name should match. If they don't match - MassTransit will try to create queue with "_skip" suffix and will send your messages there. If you will not give it permissions to create new queues - it will just fail.

  • @yhabshaker9143
    @yhabshaker9143 9 หลายเดือนก่อน

    Thank you. How can we ensure that both the data saving and message sending processes were completed successfully?

  • @julienlefevre1661
    @julienlefevre1661 ปีที่แล้ว

    Thanks for this video. What about performances of MassTransit compared to dedicated ones? :)

  • @yoanashih761
    @yoanashih761 ปีที่แล้ว +1

    Will the sqs be created automatically if we run publisher first?

    • @davidpiepgrass743
      @davidpiepgrass743 ปีที่แล้ว

      The RabbitMQ example suggests that the answer is no (and I don't know why).

  • @lebgdu31081996
    @lebgdu31081996 ปีที่แล้ว

    Just perfect, keep teaching us more please !

  • @TheMichDre
    @TheMichDre 11 หลายเดือนก่อน

    Hey Nick, great video thank you :) what still would be interesting to me is, how can we replace IMediatR with Masstransit Mediator and hook into the request pipeline to still be able to validate requests, messages etc before they reach the handler/consumer? or for doing audit, logging stuff

  • @woistdasniveau8290
    @woistdasniveau8290 ปีที่แล้ว +1

    Is messaging now considered a good practice or not i am confused on this topic.

  • @adriaarquimbaucodina7398
    @adriaarquimbaucodina7398 ปีที่แล้ว

    Nice video. What about idempotency when using a consumer that Scale-out to keep the idempotency in duplicates for example.

  • @weifengmao
    @weifengmao ปีที่แล้ว

    Dapr would be an interesting comparison to MT.

  • @alentor
    @alentor ปีที่แล้ว +2

    Make a SAGA example please

  • @maksymkyian4920
    @maksymkyian4920 ปีที่แล้ว

    Please make a video about Sagas =)

  • @bloggrammer
    @bloggrammer ปีที่แล้ว

    Missed "Special thanks to my patrons"

  • @recaicingoz6785
    @recaicingoz6785 ปีที่แล้ว

    Hello Nick, I need to ask you an question . If I use that this type to message among our service in windows 10 operation system that Won't I need any docker images etc...

  • @OsoreWatashi
    @OsoreWatashi ปีที่แล้ว

    Wondering about Wolverine here. It can interop with MassTransit if needed, but would you for new applications?

  • @superpcstation
    @superpcstation ปีที่แล้ว

    Hey nick, can you talk about Task.Yield?

  • @june3878
    @june3878 ปีที่แล้ว

    Does MassTransit allow real-time control of the banding?

  • @honfey
    @honfey ปีที่แล้ว

    Hi, Nick, from the video, it has 1 publisher which published 1 topic and then consumed by 1 consumer only. Would like to know how two consumers consume the same topic. I tried but it seems like after the 1st consumer consumed the topic, the topic will be closed and the 2nd consumer unable to consume. Appreciate if you can demo about that two consumers consume the topic successfully

  • @Mec2005
    @Mec2005 4 หลายเดือนก่อน

    @Nick, is it possible to use LiteDB with MassTransit?

  • @abdulhafeel6200
    @abdulhafeel6200 6 หลายเดือนก่อน

    Hey @Nick! Awesome video. Could you please a video with ActiveMQ Artemis using MassTransit. I am working on .NET 8 project with TDD (xUnit). There I have to implement this.

  • @lutfidwedari
    @lutfidwedari ปีที่แล้ว +1

    Thanks, Very Interesting, I just missed com comparison with other libraries that implement the AMQP protocol and with what queue transports it can use, I only see AmazonSQS, RabitMq and InMemory. Finally how does it handle disconnects?

    • @nickchapsas
      @nickchapsas  ปีที่แล้ว +2

      There is built in resiliance which I will be showcasing in a future video. MassTransit officially supports RabbitMQ, Azure Service Bus, Amazon SQS, ActiveMQ, Kafka, In Memory and gRPC

    • @pavelyeremenko4640
      @pavelyeremenko4640 ปีที่แล้ว

      @@nickchapsas This is misleading. Afaik, it supports most of these as "Riders", not as primary brokers/transport.
      So if you wanted to completely switch from rabbit to kafka, you would probably need to drop masstransit in the process.

    • @PhatBoyG
      @PhatBoyG ปีที่แล้ว

      @@pavelyeremenko4640 Only Kafka and Azure Event Hub are riders (they are both streams, not queues), and they can be used with or without a broker for the bus. So you don't need to drop anything to use MassTransit with either of these event stream providers.

    • @pavelyeremenko4640
      @pavelyeremenko4640 ปีที่แล้ว

      @@PhatBoyG Would you mind sharing code examples of using MassTransit on top of kafka?

  • @ilanb
    @ilanb ปีที่แล้ว

    Love MassTransit! We use it extensively with RabbitMQ at work.

  • @jordananderson3395
    @jordananderson3395 ปีที่แล้ว

    Rebus enters chat

  • @minhgiangho1410
    @minhgiangho1410 ปีที่แล้ว

    Assuming we have RabbitMQ transit, one consumer uses MassTransit, one publisher does not use MT, or reverse, how can they communicate with each other?

  • @SelyChangampally
    @SelyChangampally ปีที่แล้ว

    What is the benefit of this over grpc or websocket?

  • @JosephRuhundwa
    @JosephRuhundwa ปีที่แล้ว

    Super Cooooooool. Thank you very much for the video. Keep up the good work.

  • @NicholasVardy-d7i
    @NicholasVardy-d7i ปีที่แล้ว

    Is it possible to set this up using IFunctionsHostBuilder in an Azure function app? I don't get any compile time errors, but when I run it it breaks on the 'AddMassTransit' section with an error saying 'Method SerializeObject in type MassTransit.Serialization.SystemTextJsonMessageSerializer does not have an implementation'.