O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Asynchronous Microservices in nodejs

6.100 visualizações

Publicada em

Nodeconf Barcelona 2015 presentation exploring several ways of building microservices in an asynchronous way. Presented the concept of a broker as an alternative to a multiple point-to-point architecture.

Publicada em: Engenharia
  • Hello! High Quality And Affordable Essays For You. Starting at $4.99 per page - Check our website! https://vk.cc/82gJD2
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui

Asynchronous Microservices in nodejs

  1. 1. Bruno Pedro November 2015 Asynchronous Microservices in node.js
  2. 2. Summary • why microservices • synchronous vs asynchronous topologies • broker approach • code examples • patterns
  3. 3. Why Microservices • organised around business capabilities • following a decentralised governance • and a decentralised data management • automated infrastructure • designed for failure
  4. 4. in Martin Fowler, "Microservices"
  5. 5. Microservices • loosely coupled • with a specific responsibility • designed around business needs • connected through a common interface
  6. 6. H TTP HTTP HTTP HTTP
  7. 7. Synchronous
  8. 8. Latency
  9. 9. Asynchronous
  10. 10. Asynchronous
  11. 11. Complexity
  12. 12. SMTP A A Broker
  13. 13. SMTP A B C D E A B D C E
  14. 14. Really?
  15. 15. AMQP • Advanced Message Queueing Protocol • interoperable: loosely coupled clients and servers • advanced publish and subscribe • transactional, if needed
 • supported by node.js
  16. 16. AMQP
  17. 17. AMQP amqplib
  18. 18. amqplib var amqp = require('amqplib/callback_api'); amqp.connect('amqp://localhost', function(err, conn) { conn.createChannel(function(err, ch) { var q = 'hello'; ch.assertQueue(q, {durable: false}); ch.sendToQueue(q, new Buffer('Hello World!')); console.log(" [x] Sent 'Hello World!'"); }); }); in RabbitMQ Tutorials
  19. 19. amqplib var amqp = require('amqplib/callback_api'); amqp.connect('amqp://localhost', function(err, conn) { conn.createChannel(function(err, ch) { var q = 'hello'; ch.assertQueue(q, {durable: false}); console.log(" [*] Waiting for messages in %s.", q); ch.consume(q, function(msg) { console.log(" [x] Received %s”, msg.content.toString()); }, {noAck: true}); }); }); in RabbitMQ Tutorials
  20. 20. AMQP HTTP Webhook
  21. 21. Patterns • work queue • pubsub system • webhook • message routing • backpressure • RPC
  22. 22. Asynchronous Microservices • loosely coupled • agile to changes • event based • organised around business capabilities • connected through the message broker AMQP
  23. 23. Wrap-up • microservices advantages • asynchronous over synchronous • broker approach • easy to implement • patterns
  24. 24. + Sean O’Connor Lead Engineer It's great to see a tool like API Changelog come along. (…) as an API provider, it's always a challenge to communicate to users when changes happen. bpedro@apichangelog.com Get in touch! Bruno Pedro Thank you

×