Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

EWD 3 Training Course Part 8: Anatomy of the QEWD Messaging Cycle

356 views

Published on

This presentation is Part 8 of the EWD 3 Training Course. It diagrammatically explains what happens throughout the life-cycle of a QEWD message round-trip.

Published in: Software

EWD 3 Training Course Part 8: Anatomy of the QEWD Messaging Cycle

  1. 1. Copyright © 2016 M/Gateway Developments Ltd EWD 3 Training Course Part 8 Anatomy of the QEWD Messaging Cycle Rob Tweed Director, M/Gateway Developments Ltd Twitter: @rtweed
  2. 2. Copyright © 2016 M/Gateway Developments Ltd Let's summarise what happens.. • During the QEWD Message Round-trip
  3. 3. Copyright © 2016 M/Gateway Developments Ltd The QEWD Message Round-trip • Generate an event in the browser • Send a message to the QEWD back-end • At the back-end, a handler function for that message type processes the message and usually creates a response message • Response message is returned to the browser where a handler function processes it and usually modifies the User Interface
  4. 4. Copyright © 2016 M/Gateway Developments Ltd QEWD Node.js Worker Process Master Node.js Process Queue Queue processor/ dispatcher qewd cache.node ewd-qoper8-cache Global Storage Database ewd-document-store Globals ewd-session Express HTTP(S) Interface WebSocket socket.io Interface browserewd-client Custom Worker Module ewd-qoper8
  5. 5. Copyright © 2016 M/Gateway Developments Ltd After registration Browser QEWD Caché, GT.M or Redis socket.io socket.io Token stored within Closure in browser ewd-client token ewd-session
  6. 6. Copyright © 2016 M/Gateway Developments Ltd Button clicked Browser QEWD socket.io socket.io ewd-client token Event fired EWD.send() invoked
  7. 7. Copyright © 2016 M/Gateway Developments Ltd Message sent Browser QEWD socket.io socket.io ewd-client token Message augmented with token and sent to QEWD master process Message object Type + payload ewd-qoper8 queue
  8. 8. Copyright © 2016 M/Gateway Developments Ltd Message queued Browser QEWD socket.io socket.io ewd-client token Added to queue ewd-qoper8 queue
  9. 9. Copyright © 2016 M/Gateway Developments Ltd Message dispatched to worker Browser QEWD socket.io socket.io ewd-client token Message dispatched to available worker ewd-qoper8 queue Caché, GT.M or Redis
  10. 10. Copyright © 2016 M/Gateway Developments Ltd Session lookup Browser QEWD socket.io socket.io ewd-client token Token used to lookup QEWD Session ewd-session ewd-qoper8 queue Caché, GT.M or Redis
  11. 11. Copyright © 2016 M/Gateway Developments Ltd Application Name lookup Browser QEWD socket.io socket.io ewd-client token Retrieve application name ewd-session ewd-qoper8 queue Caché, GT.M or Redis
  12. 12. Copyright © 2016 M/Gateway Developments Ltd Application Name lookup Browser QEWD socket.io socket.io ewd-client token Retrieve application name Important security feature: Can't arbitrarily try to run another application's message handlers ewd-session ewd-qoper8 queue Caché, GT.M or Redis
  13. 13. Copyright © 2016 M/Gateway Developments Ltd Load application module Browser QEWD socket.io socket.io ewd-client token Load application back-end module (if not already loaded) ewd-session ewd-qoper8 queue Custom Worker Module demo1.js Caché, GT.M or Redis
  14. 14. Copyright © 2016 M/Gateway Developments Ltd Invoke message handler Browser QEWD socket.io socket.io ewd-client token Trigger message handler function for received message type ewd-session ewd-qoper8 queue Custom Worker Module demo1.js Caché, GT.M or Redis
  15. 15. Copyright © 2016 M/Gateway Developments Ltd Invoke message handler Browser QEWD socket.io socket.io ewd-client token Access Global Storage, Document Store, etc and user's QEWD Session ewd-session ewd-qoper8 queue Custom Worker Module demo1.js Caché, GT.M or Redis
  16. 16. Copyright © 2016 M/Gateway Developments Ltd Return response message(s) Browser QEWD socket.io socket.io ewd-client token Return message send() – intermediate message finished() – final message ewd-session ewd-qoper8 queue Custom Worker Module demo1.js Caché, GT.M or Redis
  17. 17. Copyright © 2016 M/Gateway Developments Ltd Handle response message(s) Browser QEWD socket.io socket.io ewd-client token Client-side response handler fires in app.js ewd-session ewd-qoper8 queue Custom Worker Module demo1.js Caché, GT.M or Redis
  18. 18. Copyright © 2016 M/Gateway Developments Ltd Update UI Browser QEWD socket.io socket.io ewd-client token User interface modified ewd-session ewd-qoper8 queue Custom Worker Module demo1.js User Interface Caché, GT.M or Redis
  19. 19. Copyright © 2016 M/Gateway Developments Ltd Worker released Browser QEWD socket.io socket.io ewd-client token Meanwhile, finished() function causes release of worker back to available pool ewd-qoper8 queue User Interface Custom Worker Module demo1.js Caché, GT.M or Redis
  20. 20. Copyright © 2016 M/Gateway Developments Ltd QEWD applications • Just repeat this pattern over and over again!

×