What Is A Message Queue + RabbitMQ and MassTransit Integration

Поділитися
Вставка
  • Опубліковано 1 січ 2025

КОМЕНТАРІ •

  • @MilanJovanovicTech
    @MilanJovanovicTech  Рік тому +5

    Want to master Clean Architecture? Go here: bit.ly/3PupkOJ
    Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt

    • @fieryscorpion
      @fieryscorpion Рік тому +1

      Great video. Do you have a blog post for this video? Couldn't find it. (I like reading instead of watching videos 😊)

    • @kristiyanivanov7414
      @kristiyanivanov7414 Рік тому

      joined it, thanks for putting all that content out there! amazing stuff

  • @PhatBoyG
    @PhatBoyG Рік тому +29

    Great video, glad you're having fun exploring MassTransit!

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +5

      I'm humbled, Chris! I've been using MassTransit on an internal project for the past 2 years, and I love it. Planning to make a lot more content around what it can do :)

    • @fieryscorpion
      @fieryscorpion Рік тому +6

      The creator of MassTransit 🚌 himself!

  • @majormartintibor
    @majormartintibor Рік тому +24

    Very good video, but I think Mass Transit + RabbitMQ would deserve and need more content. I hope you will do some follow up videos for this. Show the difference between Orchestration and Choreography. Maybe do a seperate little project and debug through 3-4 microservices involved in a transaction etc.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +5

      For sure, I have a lot more content planned around distributed systems!

    • @davittonoyan6537
      @davittonoyan6537 Рік тому

      ​@@MilanJovanovicTech Looking forward for that))

  • @mylesdavies9476
    @mylesdavies9476 Рік тому +3

    Impeccable timing, I'm just trying to get started with rabbitmq 🙂

  • @allenbythesea
    @allenbythesea Рік тому +4

    Good video and useful to explain the subject matter. I used to agree but honestly if you want to go at scale you need to move to the 2.0 (ish) of queue tech which are the cloud native queues (rabbit types) and logs (think kafka) in gcp, azure and aws. These systems provide much deeper serverless options that can scale up with little hassle. (chief arch, fortune 5)

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +3

      Good thing that with MassTransit, the messaging is abstracted. You can easily plug in Azure Service Bus. I used AWS Rabbit MQ for example.

    • @danielegiovanetti9258
      @danielegiovanetti9258 Рік тому

      @@MilanJovanovicTech you mean that this example code run perfectly in an Azure bus? Could be good to see a video where you explain the connection with Azure bus. Thanks so much for explaining this topic.

  • @velkumars26
    @velkumars26 Рік тому +1

    @Milan awesome video on RabbitMQ.
    Looking forward to see more video on this playlist like Mediator to RabbitMQ, Mass Transit - Publish vs. Send, Commands etc.

  • @kjbetz
    @kjbetz Рік тому +1

    Milan, great video as always!

  • @oleksiibubenko4905
    @oleksiibubenko4905 9 місяців тому +1

    I don't quite understand why the extra abstraction in the way of the EventBus class

  • @DoSoft-t8p
    @DoSoft-t8p 6 місяців тому +1

    Great video, I Learn a lot from u thank u

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 місяців тому

      Sure thing! Check this one also for the internals: ua-cam.com/video/zKppEQIzvcU/v-deo.html

  • @nove1398
    @nove1398 Рік тому +1

    I usually add event to the object name as well, it helps me to show explicit intent modeling IMO

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      Exactly, for the same reason I also append Command/Query to class names

  • @mahmoudalaskalany
    @mahmoudalaskalany Рік тому +1

    Great One Milan as usual
    I was searching for a related video on the channel to comment about new video idea
    It is about how to create a consumer and producer console template so that when i need new consumer or producer i just go and create a new project of that template 😅

  • @StanBubbers
    @StanBubbers Рік тому +1

    Great video, but could you explain how you've set up your project to run in a docker container. Apologies if I've missed a video where you explained this.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      I don't think I covered a Docker-compose set up from scratch. Will make a video abut that!

  • @camcommute
    @camcommute Рік тому +1

    What exchange is mass transit using? Topic? Fanout? Direct? I'm assuming it setups these with the bindings to the queue as well.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      It's different based on the underlying transport, so for RabbitMQ these are the docs: masstransit.io/documentation/transports/rabbitmq

  • @kodindoyannick5328
    @kodindoyannick5328 10 місяців тому +1

    It's very interesting video. Thank you a lot for all.

  • @SayWhaaaaaaaaaaaaaaaaaaaaaaat
    @SayWhaaaaaaaaaaaaaaaaaaaaaaat 6 місяців тому +1

    Great as always

  • @pureevil379
    @pureevil379 Рік тому +1

    Great video!
    So RabbitMQ is the lightweight database/queue persisting the events.
    You hook up Mass Transit to connect to this 'queue' and whenever an event is persisted to the queue the appropriate mass transit event handler will consume it.
    Is this an alternative to the transactional outbox pattern where you raise events to the DB and process them with a background service? They are similar. I can see the benefit of both for sure.
    This one feels more lightweight than the TransactionalOutbox -> Background Service reading jobs. But maybe that's because I am considering that with the raising of domain events and the aggregate root unit of work commits to db.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      You can think of a queue as a pipe. Something comes in on one end, and comes out on the other end.
      It's different from an outbox since it's another external system to your database. It increases the surface area for things to fail.
      I'm planning another video soon about Sagas and it'll cover queues a little bit more

  • @vanasisbaboomi7819
    @vanasisbaboomi7819 Рік тому +1

    Great Video, but one question.
    what is difference between event bus and domain event from previous videos?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      One is in-memory, one is a separate process

    • @vanasisbaboomi7819
      @vanasisbaboomi7819 Рік тому

      ​@@MilanJovanovicTech can we implement domain event with event bus? Can you tell a little more. Thanks

  • @chudo81
    @chudo81 Рік тому +2

    Great video. But its more interesting to see how to interact with non-.net consumers. Who do not know anything about masstransit and its envelope and other things.

  • @salehdanbous6783
    @salehdanbous6783 Рік тому +1

    Great, why not fire the Publish method inside a background job using Quartz or Hangfire like you did in TransactionalOutbox video?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      Didn't want to complicate it for an intro video, but that's a viable option. And what I generally do in production

    • @salehdanbous6783
      @salehdanbous6783 Рік тому

      @@MilanJovanovicTech Got it. Hope to see more videos on this subject ..

  • @salmanzafar-jr1iu
    @salmanzafar-jr1iu Рік тому +1

    Thanks for another great video.
    should it not be extending your CLEAN architecture video where the Outbox pattern was used to persist events in the database and Quartz/Hangfire as background service using MassTransit to push those events from the database to Queuing service?

  • @kostasgkoutis8534
    @kostasgkoutis8534 Рік тому +1

    What is the level of support for Mass Transit for the Outbox pattern? Is this going to be presented later or we rely on the video already shared in the Clean Architecture series?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +2

      I haven't explored it, honestly! I'm sure there's good support however, but I'll do some research and make a video.

    • @kostasgkoutis8534
      @kostasgkoutis8534 Рік тому

      I checked it quickly in the docs they do have something cooked up, I would love to see this in a video :))

  • @winstochurgle9133
    @winstochurgle9133 11 місяців тому +1

    I put a breakpoint inside of Consume() method but apparently I can't get there. I registered my Consumer inside of MassTransit configurator. I notice activity in RabbitMQ, but the consumer method isn't executed.
    Why?🤔
    I just recently started learning RabbitMQ. Shouldn't I have a queue created in this case?

    • @MilanJovanovicTech
      @MilanJovanovicTech  11 місяців тому +1

      Probably missing a call to ConfigureEndpoints inside the call the UsingRabbitMq (I forgot to mention that in the video, my bad)

    • @winstochurgle9133
      @winstochurgle9133 11 місяців тому

      @@MilanJovanovicTech You're right, I added it and now it's ok. Thanks for feedback

  • @anilkarasahh
    @anilkarasahh Рік тому +1

    I am new to the Message Queue World, I am trying to learn about it and this video helped me a lot with that.
    I have implemented everything as you did. Though, in the RabbitMQ management page, the exchange does not show any consumers and the messages just disappear on their own. No logs, no emails, no hitting breakpoints, nothing. What may cause this?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +2

      I think you're missing some configuration code. Best refer to the MassTransit docs

    • @anilkarasahh
      @anilkarasahh Рік тому +1

      ​@@MilanJovanovicTech Yeah, I have missed something. Apparently, at the very end of the lambda function of UsingRabbitMq, there should be a "configurator.ConfigureEndpoints(context);" which I was missing. It solved the problem!

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      @@anilkarasahh I believe I also missed it in the video, which added to the confusion :/

    • @anilkarasahh
      @anilkarasahh Рік тому

      @@MilanJovanovicTech It sometimes feels magical that something seems to be working on a tutorial and does not on me because something is missing. Never understood why and how :)

    •  Рік тому

      Milan forgot to configure the endpoints in the video on UsingRabbitMq. serviceBusBusFactoryConfigurator.ConfigureEndpoints(busRegistrationContext);

  • @kimberlyjacobsen4148
    @kimberlyjacobsen4148 Рік тому +1

    Great Video
    I just Noticed that with Core 6 and MassTransit 8.1.2
    you need to add rabbitMqConfigurator.ReceiveEndpoint In the Configuration for UsingRabbitMq in the Bus configurator Or am i missing somthing ?

    • @kimberlyjacobsen4148
      @kimberlyjacobsen4148 Рік тому

      just for Reference
      busConfigurator.UsingRabbitMq((context, rabbitMqConfigurator) =>
      {
      var messageBrokerSettings = context.GetRequiredService();
      rabbitMqConfigurator.Host(new Uri(messageBrokerSettings.Host),
      h =>
      {
      h.Username(messageBrokerSettings.Username);
      h.Password(messageBrokerSettings.Password);
      });
      rabbitMqConfigurator.ReceiveEndpoint("EndpointListenerName", endpointConfigurator =>
      {
      endpointConfigurator.ConfigureConsumer(context);
      });
      });

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      Yeah, must've omitted that part

  • @davittonoyan6537
    @davittonoyan6537 Рік тому +1

    Thank you, I have one question. When you publish the message how the RabbitMq stores the data? I mean does it make some kind of serialization ( json, byte array) ?

  • @estebanhugosomma3012
    @estebanhugosomma3012 Рік тому +3

    Excellent video Milan as always! I just started to learn MassTransit this week and I was need one of your videos about MassTransit, so you read my mind!
    2 questions: Can you share the source code of the video? And, MassTransit have a Mediator pattern implementation, can we replace the MediatR library for MassTransit Mediator? Greetings from Argentina!!!

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      Send me an email for the source code :)
      I haven't used MassTransit's Mediator, to be honest, so I can't really comment on it.

  • @nick066hu
    @nick066hu Рік тому +1

    Is OK to connect to the Message Queue / RabbitMQ from a client running javascript? Or would it be a design failure, an overkill, (too much load/ package size, etc.) and should translate to REST apis / websocket instead for the small clients?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      Isn't that a security concern? 🤔

    • @nick066hu
      @nick066hu Рік тому

      @@MilanJovanovicTech That's is also why I am asking, There most be reasons it is not a widespread way of doing it.
      I don't know , but you're right, I think, to protect the REST APIs + Websocket / SignalR, etc. with TLS + token auth, etc is much simpler and usual then to have the equivalent with MQTT messages on the client I don't know if such a solution exists at all.
      However on even smaller client, like a microcontroller, a direct MQTT still make sense.

  • @bayobizzle
    @bayobizzle Рік тому +1

    What's the reason for abstracting the IPublishEndpoint behind another interface IEventBus?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      You may want to introduce some logic around the publish action, and making an abstraction for that is a good idea. But you absolutely don't need to do it, and can use IPublishEndpoint directly

  • @raghavendrahabbu
    @raghavendrahabbu 7 місяців тому

    All your videos are great. Can you share the code that you are using in your videos.

    • @MilanJovanovicTech
      @MilanJovanovicTech  7 місяців тому

      Yes, here: www.patreon.com/milanjovanovic
      And on some of them, check the pinned comment in case the source code is public :)

  • @user-pq9yh
    @user-pq9yh Рік тому +4

    Pressed like before actually watching the video.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +2

      I appreciate the love 😊
      Let me know what you thought of the video.

    • @user-pq9yh
      @user-pq9yh Рік тому +1

      @@MilanJovanovicTech It was great. Thank you for sharing your knowledge

  • @iamnoob7593
    @iamnoob7593 Рік тому +1

    Hi , pls would request you to make more detailed videos involving 2 microservice + az function using Mass Transit + RabbitMq.

  • @shate74662000
    @shate74662000 Рік тому +1

    Can you make a video for Masstransit saga?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      I just recorded one for Rebus Saga, but the concepts will be similar to MassTransit

    • @shate74662000
      @shate74662000 Рік тому

      @@MilanJovanovicTech can't wait to watch

  • @TheKsenija123
    @TheKsenija123 Рік тому +1

    Hi Milan! Can I ask you something? When you use records in C# is it much simple and less code with only the constructor and pass the values through the constructor instead of properties? or this is just a clean-written code? After all, records are read-only I know. Maybe I'm wrong. Can't be modified additionally in another place with accessing some property. Thanks for the videos 🙂. Поздрав од Македонија. 😉

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +2

      I find it simpler, that's why. Plus I get immutability, etc. By no means a convention, but an approach I found useful. MassTransit also recommends using interfaces for message contracts. But this is annoying in that you'll have to make implementations on sending side, so double code. Pozdrav iz Niša :)

    • @TheKsenija123
      @TheKsenija123 Рік тому

      @@MilanJovanovicTech Thanks a lot for answering me 🙂

  • @jacobjacob8062
    @jacobjacob8062 Рік тому +1

    What exchange and queue this message was published? Because I can't see any configuration for exchange or queue

    • @mylesdavies9476
      @mylesdavies9476 Рік тому

      Good question, I guess the library provides some default values?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      MassTransit creates the required queues/topics for you in the background. It's abstracted away because it can vary depending on the actual message transport you're using.

    • @jacobjacob8062
      @jacobjacob8062 Рік тому

      @@MilanJovanovicTech OK and where is configuration for message transport? Because I see just publish message by default

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      @@jacobjacob8062 At thr beginning, the call to UsingRabbitMq

    • @jacobjacob8062
      @jacobjacob8062 Рік тому

      @@MilanJovanovicTech there is only configuration for host... But what about message transport?

  • @JZO001
    @JZO001 Рік тому +1

    Hi, is there a Github source for this demo solution?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      No, I share the code on my Patreon: www.patreon.com/milanjovanovic

  •  10 місяців тому

    Why register the IEventBus as Transient and not as Scope?

    • @MilanJovanovicTech
      @MilanJovanovicTech  10 місяців тому +1

      No particular reason. The IPublishEndpoint is scoped, so scoped would've been more correct there.

  • @nl6049
    @nl6049 Рік тому +1

    Really nice explanation/demo. I recommend you to upgrade your mic and then you'll sounds like a real pro content creator. Knowledge wise, seems like you already got what it takes :)

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      Oh, really. You think the mic doesn't cut it? 🤔

    • @nl6049
      @nl6049 Рік тому +2

      @@MilanJovanovicTech the content is great, maybe I just grew accustomed to Jeffery Way voice

  • @nove1398
    @nove1398 Рік тому

    Question, would it be wise to implement multiple IConsumer of different types to the same concrete class? Assuming the events it consumes are related?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      Good question! In theory that should work without a problem. On the other hand, I never tried it out so I have no idea how if it will work.

  • @kayasso
    @kayasso Рік тому +2

    do you guys memorize the code or what... i have never seen him using documentation in any video! so he memorize the syntax before or he opens the doc in the second screen i don't get it... and he never shares the original links. Please guys go and read the documentation you'll never learn like this

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +6

      Or he simply worked with the library for a long time that he knows the code by heart? 😅
      That's how I make most of my videos to be honest, I talk about what I know.
      And of course I do my research beforehand, to brush up my memory. But you can't expect me to teach you everything in a 10-20min video. My vision is more to explore a concept and give you some direction, and it's up to you to go and do your own research.

  • @YasSin
    @YasSin Рік тому

    I have a shirt like your one 😂. It is clone 😂

  • @june3878
    @june3878 Рік тому +1

    Everything is cool, thanks! But! It's all in the sandbox category. What if we have a producer that is an external service (not in the same namespace as the consumer), and we need to beat off messages that accidentally entered our consumer in such a way as to not crash the application. To make everything beautiful and asynchronous. Here you would show such a complex example. how great it would be! but these are all "Hello, World!" The examples don't really help, to be honest. All those examples from the documentation are too primitive and have nothing to do with the combat environment. Thank you.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      That's a pretty fair critique, to be honest. Now that I'm doing this full-time, I actually have the time to start working on some "real world" use cases for the videos

    • @june3878
      @june3878 Рік тому

      @@MilanJovanovicTech This is not criticism, this is a cry from the heart)) I have just such a task, I am intensively looking for combat options for Rabbitmq, and, alas, I can’t find it)) SOS))