Skip to content

Latest commit

 

History

History
278 lines (150 loc) · 3.24 KB

19_Listening_for_Events_and_Handling_Concurrency_Issues.md

File metadata and controls

278 lines (150 loc) · 3.24 KB

[Stephen Grider] Microservices with Node JS and React [ENG, 2020]

19. Listening for Events and Handling Concurrency Issues


01. Time for Listeners!


02. Reminder on Listeners


03. Blueprint for Listeners


04. A Few More Reminders


05. Simple onMessage Implementation


06. ID Adjustment


07. Ticket Updated Listener Implementation


08. Initializing the Listeners


09. A Quick Manual Test


$ cd nats-test
$ npm update @grider-ms-tickets/common

CREATE TICKET
UPDATE TICKET

Application


10. Clear Concurrency Issues


11. Reminder on Versioning Records


12. Optimistic Concurrency Control


Application


Application


13. Mongoose Update-If-Current

$ cd tickets
$ npm install --save mongoose-update-if-current

14. Implementing OCC with Mongoose

$ cd tickets
$ npm run test

15. Testing OCC


16. One More Test


17. Who Updates Versions


18. Including Versions in Events

$ cd common
$ npm run pub

$ cd orders
$ npm update @grider-ms-tickets/common

$ cd tickets
$ npm update @grider-ms-tickets/common

19. Updating Tickets Event Definitions


20. Applying a Version Query

$ cd orders
$ npm install --save mongoose-update-if-current

CREATE TICKET
UPDATE TICKET

Everything works after updates


21. Did it Work


22. Abstracted Query Method

CREATE TICKET
UPDATE TICKET

23. [Optional] Versioning Without Update-If-Current


24. Testing Listeners


25. A Complete Listener Test


26. Testing the Ack Call


27. Testing the Ticket Updated Listener


28. Success Case Testing


29. Out-Of-Order Events


30. The Next Few Videos


31. Fixing a Few Tests


32. Listeners in the Tickets Service


33. Building the Listener


34. Strategies for Locking a Ticket


Application


35. Reserving a Ticket


36. Setup for Testing Reservation


37. Test Implementation

$ cd tickets
$ npm run test

38. Missing Update Event


39. Private vs Protected Properties


40. Publishing While Listening


$ cd tickets
$ npm update @grider-ms-tickets/common

$ cd orders
$ npm update @grider-ms-tickets/common

41. Mock Function Arguments

$ cd tickets
$ npm run test

Sometime tests works sometime not. I did not find the reason. When run only one can works.


42. Order Cancelled Listener


43. A Lightning-Quick Test


43. A Lightning-Quick Test


44. Don't Forget to Listen!


45. Rejecting Edits of Reserved Tickets



Marley

Any questions in english: Telegram Chat
Любые вопросы на русском: Телеграм чат