Publish-Subscribe Architecture (Explained by Example)

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

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

  • @hnasr
    @hnasr  3 месяца назад

    Fundamentals of Backend Engineering backend.win

  • @sreevishal2223
    @sreevishal2223 4 года назад +47

    We need softwares to have social anxiety..!(THEBest explanation for decoupling) LMAO XDXD

  • @VY-zt3ph
    @VY-zt3ph 2 года назад +10

    You are not a techer. You are an entertainer who makes learning funnier like watching friends.

  • @gargeemukherjee8330
    @gargeemukherjee8330 3 года назад +54

    Learning from your channel is extremely asynchronous. I start somewhere and without finishing that I get extremely nested in all the linked topics! Then I recurse back to the main layer after a day or two :P

    • @barebears289
      @barebears289 3 года назад +4

      It is a complete graph. You can always start something else before u start the first thing ;)

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

      Wouldn’t this be more of a recursive paradigm rather than asynchronous? :)

  • @rainchai851
    @rainchai851 4 года назад +36

    Hi! just want to tell you:
    all your videos are soooooo goooooooooood

    • @hnasr
      @hnasr  4 года назад +1

      RAIN Chai Thanks Rain! Welcome to the channel and enjoy the content! Have a great weekend 😊

  • @hnasr
    @hnasr  4 года назад +24

    Where does request response pattern breaks 3:00
    Response request pros & cons 7:00
    Pub/sub pattern 11:12
    Pub/sub pros/cons 17:50

    • @kumailn7662
      @kumailn7662 3 года назад +5

      Can you speak more clearly, rather swallowing words or like rolling words with you saliva just speak out man. Your content is good but its hard for me to back and forth and understand your words some times.

  • @aneeshmakala4161
    @aneeshmakala4161 4 года назад +11

    Gary Vee references were a pleasant, hilarious surprise!

    • @hnasr
      @hnasr  4 года назад +1

      Gary vee is awesome 😎

  • @billbach23
    @billbach23 3 года назад +1

    Is it just me or is Heath Ledger as the Joker teaching us Publish-Subscribe Architecture?
    Really good, instructive, and entertaining video! 🙏

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

    I have been in the mind of a genius! Thank you for clearing this topic up once and for all!

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

    Your voice in between is that of heath ledger from The dark knight. Good way of teaching :)

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

    Thank you Hussein for sharing this info, finding good resources for learning fundamentals is really hard, it's just tools, tools and tools, oh and trends. I'm a musician from Colombia and in the pandemic I decided to learn programming, I didn't see any other viable option for me economically. I really like it know, I'm even planning on doing a minor in Electronic Engineering, I just want to go deeper and deeper. Just bought your networking and backend fundamentals courses, really looking forward to learn from those. REALLY GREAT STUFF. You're an amazing teacher.

  • @haq_se_dkp
    @haq_se_dkp 3 года назад +9

    Hey Hussein - ardent fan of your content - one suggestion if I may - your style of making voice modulations and jabs is good, but sometimes feels overdone and slightly irritable. If you could cut it out a lil bit, would much appreciate it.

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

      Thanks

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

      Not only that, it makes following the actual topic much harder after a long session of jib-jab. I’d say the content quality is good, but style not so

  • @aatifbangash
    @aatifbangash 4 года назад +4

    Awsome buddy. Your videos have taken me hundred levels up.

    • @andrescastillo2863
      @andrescastillo2863 4 года назад +1

      same here Hussein thank you

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

      Thanks guys! Appreciate your comments, and very happy you are learning. Are all in a continuous learning process. Suggest any new software topics you would like to see next :)

  • @amitkgpt
    @amitkgpt 3 года назад +1

    I gave an interview today where I used chaining of http calls for a postbooking scenario in transactional service. After watching this video I realised I could have done it far far better by pub/sub model. @Hussein, Thanks for making so precise content.

    • @hnasr
      @hnasr  3 года назад +1

      👍👍👍 pretty cool

  • @seunghunlee6778
    @seunghunlee6778 4 года назад +4

    Thanks you as always! Request: Kafka & how to set up kafka with node.js, database for real time apps like uber

  • @kurtcampher4716
    @kurtcampher4716 3 года назад +3

    Thank you for these videos, dude. Super helpful. Love how entertaining you make some boring topics.

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

      Glad you like the content and delivery ❤️

  • @arifbasri4950
    @arifbasri4950 3 года назад +4

    I always only know about Request and Response architecture and it's my first time working on with this pub-sub architecture.. I wonder what other architecture out there that I don't know yet

  • @jelenatrifkovic5567
    @jelenatrifkovic5567 11 месяцев назад

    I love your videos so much, because it is pretty funny the way you explain things, it's so rare. Thank you a lot

  • @ahmedtarek8792
    @ahmedtarek8792 4 года назад

    I was planning to finish the kafka crash course today but redirected from that video to here from the video links. As usual, a great one!

    • @hnasr
      @hnasr  4 года назад +1

      Ahmed Tarek take your time and enjoy the process, it might be a lot but its all Fundamentals 😊

    • @ahmedtarek8792
      @ahmedtarek8792 4 года назад

      @@hnasr Thanks. I have recently worked with Kafka and wrote some services for publishing/consuming events. I know about Pub/Sub and watched some videos/read articles about kafka but I have the feeling of knowing things in high level, for which coding is no problem but I wanted to know more about how things work in low levels. Sadly everyone likes to discuss how kafka works but I want to know why its working in a particular way and whats the reason behind that. That's why I watch your videos and they never disappoint me!

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

    man what an amazing explanation once again thank you thanks alot

    • @hnasr
      @hnasr  3 года назад

      Glad it helped!

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

    Excelent Video Hussein. Thanks!

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

    I am your subscriber, I wont check every hour "if you uploaded new content", I will check the notification if it came, I will consume your content.
    Thanks for explaining it nicely :)

  • @hnasr
    @hnasr  3 года назад +1

    Updated video with more content and fixed audio
    Publish-Subscribe Pattern vs Message Queues vs Request Response (Detailed Discussions with Examples)
    ruclips.net/video/DXTHb9TqJOs/видео.html

  •  Год назад

    "We want software to have social anxiety". That was genius 😁.

  • @MarcoAZeballosS
    @MarcoAZeballosS 3 года назад

    I haven't seen the video yet, but by reading that video description I'm more than eager to watch it!
    I'm coming from Apache Kafka Crash Course, amazing video as well, thank you Hussein, got my like, subscribe and alerts

  • @anujmishra4013
    @anujmishra4013 4 года назад +4

    nice way to teach i really like your video thanks

    • @hnasr
      @hnasr  4 года назад

      Thanks Anujm !! Happy you like the content .. let me know what software engineering content I should make next cheers

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

    I really loved the way you lectured! ☺️

    • @hnasr
      @hnasr  4 года назад

      Thank you Naresh!! 🙏 happy you enjoy the lecture

  • @diale13
    @diale13 3 года назад +1

    Gold tier explanation! Thank you!!

  • @gamer-gw9iy
    @gamer-gw9iy 3 года назад +1

    22:15 Wouldn't sending an acknowledgement over something like TCP (which ensures packets are sent for you) guarantee that at some point the message queue would be able to know that the message was consumed? What kind of research do you mean?

    • @hnasr
      @hnasr  3 года назад

      Remember there are two different communication going on. TCP acknowledges segments (did The machine received the segment it sent). While the queue communication is built on top of TCP as an application, so sending a “message” might translate to 10 segments. Those segments might have all delivered at the TCP stack, but the message has to be acknowledged by the application once it is processed (not just delivered). The acknowledgment is just another message that is sent from the other machine and might have 1 or more TCP segments

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

    Thank you so much sir! You make wonderful and really insightful content and it's really well explained ✨

  • @barebears289
    @barebears289 3 года назад

    Best part: "in this video," 😂🤣 0:25

  • @geek.with.a.camera
    @geek.with.a.camera 3 года назад +4

    14:47 "This guy has to be up all the time... that's what she said" 😂😂😂

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

    You crack me up man, great stuff! I definitely learned something.

  • @Finn-jp6pn
    @Finn-jp6pn 4 года назад +1

    We want software to have social anxiety... xD Thanks for that. Never forgetting what decoupling means

  • @shashikantpawar7069
    @shashikantpawar7069 3 года назад +1

    Thank you again for the great content ...It is possible for you to make a tutorial with a website that use this all concepts so all pieces can come in a place ..please 🙏🙏

  • @dakshjain1227
    @dakshjain1227 4 месяца назад

    In the Pub/Sub model, how does the client know if some problem occurs in the process. Suppose there was a problem compressing the file. The process cannot go any further. But how do we tell the client that the process was not successful?

  • @ramendraranjan194
    @ramendraranjan194 3 года назад

    Video is quiet good and I am watching at 1.75 speed :-)

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

    sir your explanations are amazing. keep up the good work!

  • @anthara9
    @anthara9 3 года назад

    Really awesome!! Liked this and Kafka videos. Going to watch more from you!! Thanks a bunch!!

  • @varundey9790
    @varundey9790 3 года назад +9

    ...that means that this guy has to be up all the time.
    * That's what she said. *
    Hilarious !!

  • @jenjuuu
    @jenjuuu 4 года назад

    Thank you for this great video. You have such a great way of explaining and presenting stuff. It's easy to follow and funny as well. Cheers!

  • @utkarshtripathi2349
    @utkarshtripathi2349 4 года назад

    Wohh wohh that's the video I was looking for; Thanx sir for publishing quality content

  • @sanjaykanth3653
    @sanjaykanth3653 3 года назад

    sooooooooooo gooood ur teaching ....... i love it ......really really soo excellent sir .... keep going.....

  • @MM-iu4rg
    @MM-iu4rg 2 года назад

    Very clear and easy to follow; thank you!

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

    Great video, thanks! But I think it'll be better if the side comments weren't there, as they're confusing (at least for me).
    Thank you, again.

  • @fidelsilva2621
    @fidelsilva2621 4 года назад +3

    Kafka please

  • @amanjain9110
    @amanjain9110 4 года назад +3

    Are you a dubbing artist too?? Your voice modulation is amazing :P

    • @hnasr
      @hnasr  4 года назад +7

      Aman Jain thanks Aman! In case RUclips doesn’t pan out I know what career I should pursue next

  • @waterislife9
    @waterislife9 4 года назад +1

    Amazing content my friend. Thank you!

  • @ishansourav1371
    @ishansourav1371 3 года назад +1

    Hey Hussein love your content! I have a small doubt, the message queue/channel in between is a different server right? So, is single point of failure also possible here as a disadvantage?

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

      Correct if the broker is a single machine than its a SPOF, but most message queue systems use a distributed approach such as Kafka and RabbitMQ. I made a video about those two .

  • @tekfreaks
    @tekfreaks 4 года назад +1

    Loved your content :) . I appreciate your efforts. Thanks

    • @hnasr
      @hnasr  4 года назад

      Appreciate you Waseem

  • @bigbigder
    @bigbigder 3 года назад

    This video is very useful for me. Thank you!

  • @mateuszgabor4714
    @mateuszgabor4714 3 года назад +1

    Dziękujemy.

  • @user-gk8ur3mb9n
    @user-gk8ur3mb9n 4 года назад +1

    Everything is clear and funny :D

    • @hnasr
      @hnasr  4 года назад

      Tim T

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

    Hussein is a legend :)

  • @user-lx1qt8gq2l
    @user-lx1qt8gq2l Год назад

    Best ever I watched.🤓

  • @parasarora5869
    @parasarora5869 3 года назад

    Sir...Just Loved it. Learned something new. Thanks a lot ! also...love your funny style

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

    Thanks a lot, sir. Can you make a video about designing a notification service with node js?

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

      Great idea 💡! Thanks

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

    You are amazing bro 😆

  • @mrmuranga
    @mrmuranga 3 года назад

    engaging and well explained...thanks....

  • @sachinnaidoo5598
    @sachinnaidoo5598 4 года назад

    This man has like 9 personalities in this video

  • @HKCS-yn5nc
    @HKCS-yn5nc 4 года назад

    جَزَاكَ ٱللَّٰهُ خَيْرًا Hussein.
    Really helped me compare CoAP and MQTT protocols. It also helped me notice application of pub-sub architecture in both the CDMA and distributed bus arbitration protocols.

  • @user-ur2qq1zo1p
    @user-ur2qq1zo1p 4 месяца назад

    Thanks!

  • @jain007neeraj
    @jain007neeraj 4 года назад

    Hi Hussein.... Vids are too good, just a suggestion if you can try Slides in dark mode for your newer videos..... which puts less strain on our eyes and we can binge watch your content :)

    • @hnasr
      @hnasr  4 года назад

      Thanks for the suggestion! Lots of people requested that too so new video slides are all dark themed 👍

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

    the chaining exemple part where it break is just odd; there are so many problems with it, which definitely aren't the chain; because why would the notification service pass through all these layers? that just doesn't make sense, and if some mad-man really designed its architecture like that, it's not the notification logic that is at fault XD

  • @LawZist
    @LawZist 4 года назад

    GREAT video! thanks!

  • @matShenron
    @matShenron 4 года назад

    Thanks for the video, nice energy!

    • @hnasr
      @hnasr  4 года назад +1

      Malik Aghiles Tahir thanks Malik!!

  • @jumbo_mumbo1441
    @jumbo_mumbo1441 3 года назад

    6:30 why couldn’t you just pass metadata along with the requests and build an architecture where the notifications machine passes to the upload machine so that nothing’s actually waiting?

  • @sandakinh
    @sandakinh 3 года назад

    Great video. Thanks and do kafka video please.

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

    amflearning by doing guys

  • @vixmbithi
    @vixmbithi 3 года назад

    How come some of the videos are restricted access?

  • @almazk8058
    @almazk8058 3 года назад

    This video is understood even for not developers. Great explanation!!

  • @shreerangakv7183
    @shreerangakv7183 3 года назад

    Very good explanation sir, but I still have one doubt, if upload service after doing its job pushes it's content to some DB and all the other services can query from that DB and remain Decoupled right ? Then again why queues

  • @madeofhuman
    @madeofhuman 4 года назад

    More Cali Hussein, please. Thank you.

    • @hnasr
      @hnasr  4 года назад

      CJ 😂😂

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

    Publish-Subscribe Architecture (Explained by Jim Carrey)

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

    HI! thanks for the content, but i have a doubt. you mentioned that pub-sub mehanism couldn't know whether the message is consumed or not but in kafka we can come to know that, and due to that only we can calculate the lag, am i missing something? pls answer my query

  • @mostafakhaki00
    @mostafakhaki00 4 года назад

    Hi Hussein
    thanks for cool videos
    please can you talk more about Message Queue VS Pub/Sub System?

    • @hnasr
      @hnasr  4 года назад

      Mostafa Khaki hey Mostafa, I discuss the difference in this video What is a Message Queue and When should you use Messaging Queue Systems Like RabbitMQ and Kafka ruclips.net/video/W4_aGb_MOls/видео.html

  • @jivanmainali1742
    @jivanmainali1742 3 года назад

    how should we model a datanase of follow following??And does cassandra does the job?

  • @pratikmbm1990
    @pratikmbm1990 4 года назад

    Great Video.. u take pride in teaching, it seems :)

    • @hnasr
      @hnasr  4 года назад +1

      Thanks Pratik! I do I love sharing what I know and have the opportunity to learn more from people who comment, correct wrong things i said and suggest other ideas.

  • @69MrUsername69
    @69MrUsername69 3 года назад

    Interested in kaftka media server using pub/sub! Nice

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

    Hi Nasser , thanks for your video , can you please share a demo how can I test pub/sub hosted in cloud using java as the programming language

  • @nimashafiee6845
    @nimashafiee6845 3 года назад

    bro the commentary is hilarious, keep it up

  • @nosh3019
    @nosh3019 3 года назад

    kafka. Thanks!

  • @digitaldevboss324
    @digitaldevboss324 3 года назад

    So what technique should I use to accomplish this? I'm working on getting a full understanding of node and express REST server. I'm avoiding graphql which I have found a few examples off but till I get REST down first I'd like to avoid using graphql. I was also trying to avoid adding a message broker such as kafka or redis at the moment as I thought it might add a bit of confusion. So I'm left with a thought process of setting up a switch statements and an array of messages(?? would this even work?). I know that's not a great solution though, so I'd think I'd have to store the array in a db anyways. So is redis or others needed for this pub/sub, or can I achieve this using websockets? **If its possible to do without sockets or a message broker but just isn't a great option, is it possible you could explain how that may be done anyways? I like to understand basics before adding any extra.

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

    So does the message queue initiate a TCP connection with a given subscription service only when a particular channel is created? Like when the queue receives the 1080P video, we configure it to inform the Notification service, so it establishes a new TCP connection and sends the video?
    (Or is it okay to have a TCP connection established with all services from the start, this feels a bit expensive for the message queue though)

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

      Depends. I would imagine a pool of connections will already preheated and established. But that of course needed to be played by ear if the channel is not as busy to free up resources

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

      @@hnasr ah okay! Btw Loving your backend engineering playlist,so much to learn and think about! Thanks!

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

    + 1 on wanting software to have social anxiety! hah

  • @zzzzzzzzzzsh
    @zzzzzzzzzzsh 3 года назад

    Ammmmmmazing video!

  • @youee1234
    @youee1234 4 года назад

    Thank you so much man

  • @neeravarora530
    @neeravarora530 4 года назад

    Thank u so much

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

    6:45 😂😂
    im rofl at the whole video

  • @saeedrasooli5931
    @saeedrasooli5931 3 года назад +1

    so funny Hussein :-))

    • @hnasr
      @hnasr  3 года назад +1

      ❤️

  • @SoulReaper599xx
    @SoulReaper599xx 4 года назад +1

    Rest is better overall. I'm biased

  • @AlKhawarizmi2
    @AlKhawarizmi2 4 года назад

    What happens if the subscriber has a dynamic IP address and their IP has changed after subscribing to a topic? How will the publisher know the new IP so it can notify the subscriber? Is this handled transparently for us?

    • @hnasr
      @hnasr  4 года назад +1

      Good question! When your IP address changes that is an indication that you moved from one tower to another tower in cellular network or your lease has expired ill take the worse case scenario when you move towers. What usually happens here is your existing TCP connections will be dropped and the client is responsible for reconnecting. When the consumer reconnect again with the same id the publisher will recognize the consumer. Consumer id or channel id is important here
      If you are using a broker with push model (RabbitMQ) then rabbitMQ Will hold your messages for a period of time when you were disconnecting and push all messages when you connect back. If your broker uses long pull or pull model then its up to the consumer to pull whenever its ready.
      So to answer your questions I believe the client (consumer) will be responsible for reestablishing the connection when it drops..

    • @AlKhawarizmi2
      @AlKhawarizmi2 4 года назад

      @@hnasr Great detailed explanation! Thank you for the informative content :))

  • @LawZist
    @LawZist 4 года назад +1

    Is it correct to say that REST is synchronous communication, while PUB/SUB is asynchronous?

    • @hnasr
      @hnasr  4 года назад +1

      Depends, whether you mean sync vs async on the client or sync vs async on the backend.
      lets go back to what sync and async means. It means whether the client making the request is blocked or not. Blocking means synchronous and non blocking means asynchronous, so both REST and pubsub can be sync or async really depends on the client.
      Now, if you meant the asynchronousy in term of the entire system, then sure PUBSUB is asynchronous while REST is synchronous, back to my youtube example
      In case of REST. the mobile phone uploads a video and get back the successful result after all services processes the request (upload, compressed etc) So that is synchronous on the backend your services waited until everything was completed.
      However in case of pubsub mobile phone uploaded the video and once the video was uploaded it got back a result. BUT the video is not fully ready to be consumed so thats asynchronous backend.
      Tricky stuff hope that make sense..
      Here is a video i made talking more about asynchronous backend ruclips.net/video/LMaVIqfb3TQ/видео.html

  • @mosaed_b
    @mosaed_b 4 года назад

    When you said "why i am referring to a computer as a gender?" I just realized that I am doing it most time 😂 It is linguistic issue bro, you might understood me 🤣

    • @mosaed_b
      @mosaed_b 4 года назад

      "Ok I don't know" 🤣 Oh my, what a humor sense do you have man 😂. Thanks for the astonishing software engineering content you make.

    • @hnasr
      @hnasr  4 года назад +1

      Masaad B I think its because of Arabic language we don’t have an “it” everything is she or he so My English suffer as a result lol
      Thanks Masaad!

  • @0enzogamer0
    @0enzogamer0 3 года назад

    11:06 thought you were having a seizure or something hahahahah

  • @arifbasri4950
    @arifbasri4950 3 года назад

    Have you ever used or know Stoq automation framework?

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

    thx

  • @atiehjamshidpoor6664
    @atiehjamshidpoor6664 3 года назад

    Thanks

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

    14:49 👀 You Naughty Naughty

  • @rayhanejebbari1612
    @rayhanejebbari1612 4 года назад

    You should maybe make a video about active mq :D

    • @hnasr
      @hnasr  4 года назад +1

      Yes I should!