APIs Vs. Events | Can they coexist? | API First or Event First | Tech Primers

Поделиться
HTML-код
  • Опубликовано: 25 июл 2024
  • This video covers APIs and Events. We look at the comparison by leveraging a Case Study on Payment Interface which shows how they both coexist in the same architecture
    💥 Join TechPrimers Slack Community: bit.ly/JoinTechPrimers
    💥 Telegram: t.me/TechPrimers
    💥 TechPrimer HindSight (Blog): / techprimers
    💥 Website: techprimers.com
    💥 Slack Community: techprimers.slack.com
    💥 Twitter: / techprimers
    💥 Facebook: TechPrimers
    💥 GitHub: github.com/TechPrimers or techprimers.github.io/
    🎬Video Editing: FCP
    ---------------------------------------------------------------
    🔥 Disclaimer/Policy:
    The content/views/opinions posted here are solely mine and the code samples created by me are open sourced.
    You are free to use the code samples in Github after forking and you can modify it for your own use.
    All the videos posted here are copyrighted. You cannot re-distribute videos on this channel in other channels or platforms.
    #APIPrimer #Events #TechPrimers
  • ХоббиХобби

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

  • @DVineMe
    @DVineMe 2 года назад +13

    The real comparison should be between REST and Event-driven, not API vs Events since an API can be Event-driven as well. So the example's not really that great, because the client still communicates to the server through a RESTful API. Regardless of any Event-driven logic on the back-end (which, except for the API triggering this process, has got nothing to do with the API) that the client doesn't care about, as long as the client doesn't ask the server if any change occurred the client will be blissfully unaware. So instead of having the client nagging a RESTful API every x-amount time you'd have an Event-driven API telling the client when something has changed. In this example however there's no need for an Event-driven API (since the client wouldn't need to be notified that they themselves just did a transaction, and the transaction history should only be supplied when asked for). A better example would've been where client x makes a payment to client y and client y receiving a notification that a payment has been made. ;)
    Just putting that out there lol.

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

    In today's world not sure if there is any system where Events are not required, if we are not going for bare minimum CQRS also we need events for auditing. great video as always.

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

      Yes. You are right buddy. ✌🏼

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

    Good presentation!! Excellent info

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

    Good explanation...thanks for this video

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

    Was searching on integrating synchronous and asynchronous modes of communication.
    Stumbled upon this gem. Tech Primers you are just awesome. Thanks once again...!!

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

      Glad it’s useful Abhinav. Cheers✌🏼

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

    I'm following this channel for more than 2 years.. I can proudly say , you are my Guru in this competitive world ... FYI I have struggled a lot to get into a new project due to my legacy technologies but after I found this channel and when I gone through the videos then I got confidence and immediately I got a banking project with in a few days... please consider this message as my gratitude 🙏❤

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

      sorry to be so offtopic but does anybody know of a method to log back into an Instagram account..?
      I stupidly forgot the account password. I love any assistance you can give me

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

      @@jamalfinnley4135 sorry to be so offtopic but does anybody know of a method to trace back the exact route to find the lost object? I stupidly forgot the room keys somewhere. I love any assistance you can give me

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

    Awesome

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

    APIs can also be asynchronous. We can call an API and provide a webhook which can be called later on when the response is available

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

    Walking through the example was good!!

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

      Thank you Chetan. Glad it’s understandable

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

    Awsome example to understand where,how,why to use api and events

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

      Thank you Mohan. Glad it’s understandable

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

    Good

  • @mrsbootsworkouts
    @mrsbootsworkouts 8 месяцев назад

    Excellent point about APIs eventually causing a bottleneck in a complex system

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

    Excellent example of event and api! 😊🙏

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

      Thank you. ✌🏼

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

      dude u look wierdly funny when u laugh rofl 🤣

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

    It is often said that Event Driven architecture helps in asynchronous communication
    While in Request-Driven Architecture- api calls are synchronous and it need to keep waiting until response comes from server.
    So I have a question that C# "async Task" apis aren't asynchronous apis? Isn't that solving that synchronous api call problem

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

    Can you also help us understand the best practices to be applied for overcoming the limitations in event based system

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

      There are multiple factors involved here Swaroop. They increase based on the usecases and scenarios. I have put some of them below:
      1. Resiliency of the system, if your events are time bound, then you have to have a way to reverse your transactions/events if the event was not processed within a particular timeframe.
      2. If persistence fails while processing the event, we need to figure out a way to reprocess them or reverse the original transaction by creating compensating events.

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

    Thanks for the great comparison. Just had one small question if you can please explain even in chat will do...
    Q. Since for auditing history we are writing through message queue an not from within the same flow, how to make sure if the write in history was successful?
    incase not, the real time transaction still has happened?

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

      That's the downside of an event based system. It's not strongly consistent like APIs. Hence, we rely on the Transaction Processor to have resiliency handled to make sure it doesn't delay the audit much. Theoretically, we want all our systems to be consistent. Practically, we may require the audit history after few mins or hours. So, the transaction processor should catch up with the transactions by then. If not, we need to fix the resiliency of the processor.
      This is the trade-off we need to take while designing APIs vs Events.

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

      @@TechPrimers Thank you so much for explaining. Clear and crisp.

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

    Do you have any tools similar to open API for event documentation that can be autogenerated?

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

      There is CloudEvents.io for event specification. You can use codegen to generate pojos from the spec

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

    In my opinion - It’s the business which drives the decision of API vs Events. Quite often they go hand in hand together, in most cases every call to POST API(s) generates a (domain) event;
    Transactions DB - If you are referring this to be a In memory database or even some sort of cache that would be a real bad design for any application which handles payment data.
    For any payment related applications it’s always recommended to use the original database.

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

    Does an API need to necessarily be synchronous? Can't we just queue the request?

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

    Can you sharere a video about "Netflix Cosmos Platform" ?