SlideShare une entreprise Scribd logo
1  sur  14
How RedDwarf Uses RabbitMQ

           Hong Yuan
      HPCloud OaaS & DaaS
RabbitMQ Basics Refresh
 Queue
   Store messages in order
 Exchange
   Routing table to map routing keys with queues
 Routing Key
   String/pattern used to look up queues to talk
 Channel
   Exchange + Queue + Routing Key
RedDwarf RPC the Messaging Library
 RedDwarf RPC library wraps up RabbitMQ messaging
  modules and provides 2 + 1 messaging models
 RPC.cast
    Asynchronous call with no waiting for response
    One-way from API Server to Smart Agent
 RPC.call
    Synchronous call waiting for response
    Round trip from API Server to Smart Agent
 RPC.listen
    Asynchronous call with no waiting for response
    One-way from API Server to Smart Agent
    Smart Agent cannot use RPC.cast as it is independent of
     RedDwarf code base
Asynchronous Call (rpc.cast)
 On the API Server side, a MQ publisher is
  instantiated to send the message to a topic exchange
    Exchange name = “nova”
    Routing key = hostname
 On the Smart Agent side, the message is fetched by a
  MQ consumer and passed to the Worker in charge
  of the task
    Exchange name = “nova”
    Routing key = hostname
Asynchronous Call (rpc.cast)

                                        Hostname =
                          Routing Key    “host1”
API Server 1                            SmartAgent
                               =
               Exchange     “host1”

                          Routing Key   Hostname =
               Name =
API Server 2                   =         “host2”
               “Nova”
                            “host2”     SmartAgent
               Type =
               “topic”    Routing Key
                               =
                                        Hostname =
API Server N               “hostN”
                                         “hostN”
                                        SmartAgent
Synchronous Call (rpc.call)
 RedDwarf API, rpc.call()
    Send and Wait
    Response required
    Two-way between API and Smart Agent
 One Topic Publisher instantiated to send the message request to
  MQ; Meanwhile, one Direct Consumer is instantiated to wait for the
  response message.
 On the other end, the message is consumed by one Topic Consumer
  dictated by the routing key (such as Instance ID or hostname)
 Once the task is completed, one Direct Publisher is allocated to
  send the response message to MQ
 One Direct Consumer dictated by the routing key (such as 'msg_id')
  on the rpc.call Sender side consumes the response message.
 The direct exchange and queue identifiers are determined by a
  UUID generator, and are marshaled in the request message
 The direct channel’s life-cycle is limited to the message delivery
Synchronous Call (rpc.call)
                          Routing Key
                               =
                                        Hostname =
API Server 1                “host1”
                 Topic                   “host1”
 Message       Exchange   Routing Key   SmartAgent
UUID =1234                     =
                Name =      “host2”
                “Nova”                  Hostname =
                          Routing Key    “host2”
API Server 2                   =        SmartAgent
                           “hostN”

                Direct                  Hostname =
               Exchange   Routing Key    “hostN”
API Server N
                               =        SmartAgent
                Name =      “1234”
                “1234”
Phone-Home Call from SmartAgent
 Asynchronous call from Smart Agent to API Server
 HPCS extension to RedDwarf RPC library
 Phone-Home as new use cases
   API Server has no idea how long to complete instance
    creation
   Need Smart Agent to automatically phone home for
    updating the instance state when it’s done
 Background listener to passively waiting on MQ for
  Smart Agent’s phone home messages
 A direct consumer is instantiated at the API Sever at
  its starting time
Phone-Home Call (rpc.listen)

                                                Hostname =
                                                 “host1”
API Server 1                                    SmartAgent

                                Exchange
                Routing Key                     Hostname =
API Server 2         =           Name =          “host2”
               “phonehome”    “phonehome”       SmartAgent
                              Type = “direct”

                                                Hostname =
API Server N                                     “hostN”
                                                SmartAgent
Topic Publisher
 Topic Publisher used for both rpc.call() and rpc.cast()
 Instantiated and used to push a message to the RabbitMQ
 Every publisher connects always to the same topic-based
  exchange
 Life-cycle is limited to the message delivery
Topic Consumer
• Used to receive messages from RabbitMQ sent by both
  rpc.call and rpc.cast
• Instantiated by Agent instance and exists throughout
  Agent instance’s life-cycle
• Connects to the same topic-based exchange either via
  a shared queue or via a unique exclusive queue
• Every Agent has two topic consumers
   – One for rpc.cast and it connects to a shared queue
   – One for rpc.call and it connects to a unique queue
• Used by Agent to invoke the appropriate action based
  on the request coming in
Direct Consumer
 Used for receiving the response message from Agent
 Comes to life only when rpc.call operation is executed
 Instantiated and used to receive response message
  from the queuing system
 Every consumer connects to a unique direct-based
  exchange via a unique exclusive queue named by
  message UUID
 Life-cycle of the queue limited to the message delivery
 The exchange and queue identifiers are determined by
  a UUID generator, and are marshaled in the message
  sent by the Topic Publisher (only rpc.call operations)
Direct Publisher
• Used by Agent Server to return the message required
  by the request operation
• Comes to life only during rpc.call operations
• Connects to a direct-based exchange whose identity
  is dictated by the incoming message UUID
• Life-cycle is limited to the message delivery
Topic Exchange
• On RabbitMQ Server
• The Exchange is a routing table that exists in
  the context of a virtual host (the multi-
  tenancy mechanism provided by RabbitMQ);
  its type (such as topic vs. direct) determines
  the routing policy; a RabbitMQ node will have
  only one topic-based exchange for every topic
  in Nova.

Contenu connexe

En vedette

Evented applications with RabbitMQ and CakePHP
Evented applications with RabbitMQ and CakePHPEvented applications with RabbitMQ and CakePHP
Evented applications with RabbitMQ and CakePHPmarkstory
 
Webinar Slides: Real time Recommendations with Redis, Java and Websockets
Webinar Slides: Real time Recommendations with Redis, Java and WebsocketsWebinar Slides: Real time Recommendations with Redis, Java and Websockets
Webinar Slides: Real time Recommendations with Redis, Java and WebsocketsRedis Labs
 
Node and Micro-Services at IBM
Node and Micro-Services at IBMNode and Micro-Services at IBM
Node and Micro-Services at IBMDejan Glozic
 
%w(map reduce).first - A Tale About Rabbits, Latency, and Slim Crontabs
%w(map reduce).first - A Tale About Rabbits, Latency, and Slim Crontabs%w(map reduce).first - A Tale About Rabbits, Latency, and Slim Crontabs
%w(map reduce).first - A Tale About Rabbits, Latency, and Slim CrontabsPaolo Negri
 
Life in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoLife in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoTareque Hossain
 
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM DeploymentJoe Kutner
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsHoucheng Lin
 
High powered messaging with RabbitMQ
High powered messaging with RabbitMQHigh powered messaging with RabbitMQ
High powered messaging with RabbitMQJames Carr
 
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard WolffArchitecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard WolffJAX London
 
Micro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factorsMicro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factorsDejan Glozic
 
MicroService Architecture
MicroService ArchitectureMicroService Architecture
MicroService ArchitectureFred George
 
Micro Service Architecture
Micro Service ArchitectureMicro Service Architecture
Micro Service ArchitectureEduards Sizovs
 
MapStore 2, modern mashups with OL3, Leaflet and React
MapStore 2, modern mashups with OL3, Leaflet and ReactMapStore 2, modern mashups with OL3, Leaflet and React
MapStore 2, modern mashups with OL3, Leaflet and ReactGeoSolutions
 

En vedette (16)

Evented applications with RabbitMQ and CakePHP
Evented applications with RabbitMQ and CakePHPEvented applications with RabbitMQ and CakePHP
Evented applications with RabbitMQ and CakePHP
 
Webinar Slides: Real time Recommendations with Redis, Java and Websockets
Webinar Slides: Real time Recommendations with Redis, Java and WebsocketsWebinar Slides: Real time Recommendations with Redis, Java and Websockets
Webinar Slides: Real time Recommendations with Redis, Java and Websockets
 
Reducing load with RabbitMQ
Reducing load with RabbitMQReducing load with RabbitMQ
Reducing load with RabbitMQ
 
Node and Micro-Services at IBM
Node and Micro-Services at IBMNode and Micro-Services at IBM
Node and Micro-Services at IBM
 
%w(map reduce).first - A Tale About Rabbits, Latency, and Slim Crontabs
%w(map reduce).first - A Tale About Rabbits, Latency, and Slim Crontabs%w(map reduce).first - A Tale About Rabbits, Latency, and Slim Crontabs
%w(map reduce).first - A Tale About Rabbits, Latency, and Slim Crontabs
 
Django cryptography
Django cryptographyDjango cryptography
Django cryptography
 
Life in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoLife in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with django
 
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment
 
Art Of Message Queues
Art Of Message QueuesArt Of Message Queues
Art Of Message Queues
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example Applications
 
High powered messaging with RabbitMQ
High powered messaging with RabbitMQHigh powered messaging with RabbitMQ
High powered messaging with RabbitMQ
 
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard WolffArchitecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
 
Micro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factorsMicro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factors
 
MicroService Architecture
MicroService ArchitectureMicroService Architecture
MicroService Architecture
 
Micro Service Architecture
Micro Service ArchitectureMicro Service Architecture
Micro Service Architecture
 
MapStore 2, modern mashups with OL3, Leaflet and React
MapStore 2, modern mashups with OL3, Leaflet and ReactMapStore 2, modern mashups with OL3, Leaflet and React
MapStore 2, modern mashups with OL3, Leaflet and React
 

Similaire à Red dwarf&rabbit

MessagePack Rakuten Technology Conference 2010
MessagePack Rakuten Technology Conference 2010MessagePack Rakuten Technology Conference 2010
MessagePack Rakuten Technology Conference 2010Sadayuki Furuhashi
 
Fast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCFast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCTim Burks
 
Feb 2013 HUG: Large Scale Data Ingest Using Apache Flume
Feb 2013 HUG: Large Scale Data Ingest Using Apache FlumeFeb 2013 HUG: Large Scale Data Ingest Using Apache Flume
Feb 2013 HUG: Large Scale Data Ingest Using Apache FlumeYahoo Developer Network
 
Socket programming using java
Socket programming using javaSocket programming using java
Socket programming using javaUC San Diego
 
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...Apigee | Google Cloud
 

Similaire à Red dwarf&rabbit (7)

MessagePack Rakuten Technology Conference 2010
MessagePack Rakuten Technology Conference 2010MessagePack Rakuten Technology Conference 2010
MessagePack Rakuten Technology Conference 2010
 
Fast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCFast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPC
 
RIPP Notes
RIPP NotesRIPP Notes
RIPP Notes
 
Feb 2013 HUG: Large Scale Data Ingest Using Apache Flume
Feb 2013 HUG: Large Scale Data Ingest Using Apache FlumeFeb 2013 HUG: Large Scale Data Ingest Using Apache Flume
Feb 2013 HUG: Large Scale Data Ingest Using Apache Flume
 
Socket programming using java
Socket programming using javaSocket programming using java
Socket programming using java
 
Socket programming
Socket programmingSocket programming
Socket programming
 
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
 

Dernier

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 

Dernier (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 

Red dwarf&rabbit

  • 1. How RedDwarf Uses RabbitMQ Hong Yuan HPCloud OaaS & DaaS
  • 2. RabbitMQ Basics Refresh  Queue  Store messages in order  Exchange  Routing table to map routing keys with queues  Routing Key  String/pattern used to look up queues to talk  Channel  Exchange + Queue + Routing Key
  • 3. RedDwarf RPC the Messaging Library  RedDwarf RPC library wraps up RabbitMQ messaging modules and provides 2 + 1 messaging models  RPC.cast  Asynchronous call with no waiting for response  One-way from API Server to Smart Agent  RPC.call  Synchronous call waiting for response  Round trip from API Server to Smart Agent  RPC.listen  Asynchronous call with no waiting for response  One-way from API Server to Smart Agent  Smart Agent cannot use RPC.cast as it is independent of RedDwarf code base
  • 4. Asynchronous Call (rpc.cast)  On the API Server side, a MQ publisher is instantiated to send the message to a topic exchange  Exchange name = “nova”  Routing key = hostname  On the Smart Agent side, the message is fetched by a MQ consumer and passed to the Worker in charge of the task  Exchange name = “nova”  Routing key = hostname
  • 5. Asynchronous Call (rpc.cast) Hostname = Routing Key “host1” API Server 1 SmartAgent = Exchange “host1” Routing Key Hostname = Name = API Server 2 = “host2” “Nova” “host2” SmartAgent Type = “topic” Routing Key = Hostname = API Server N “hostN” “hostN” SmartAgent
  • 6. Synchronous Call (rpc.call)  RedDwarf API, rpc.call()  Send and Wait  Response required  Two-way between API and Smart Agent  One Topic Publisher instantiated to send the message request to MQ; Meanwhile, one Direct Consumer is instantiated to wait for the response message.  On the other end, the message is consumed by one Topic Consumer dictated by the routing key (such as Instance ID or hostname)  Once the task is completed, one Direct Publisher is allocated to send the response message to MQ  One Direct Consumer dictated by the routing key (such as 'msg_id') on the rpc.call Sender side consumes the response message.  The direct exchange and queue identifiers are determined by a UUID generator, and are marshaled in the request message  The direct channel’s life-cycle is limited to the message delivery
  • 7. Synchronous Call (rpc.call) Routing Key = Hostname = API Server 1 “host1” Topic “host1” Message Exchange Routing Key SmartAgent UUID =1234 = Name = “host2” “Nova” Hostname = Routing Key “host2” API Server 2 = SmartAgent “hostN” Direct Hostname = Exchange Routing Key “hostN” API Server N = SmartAgent Name = “1234” “1234”
  • 8. Phone-Home Call from SmartAgent  Asynchronous call from Smart Agent to API Server  HPCS extension to RedDwarf RPC library  Phone-Home as new use cases  API Server has no idea how long to complete instance creation  Need Smart Agent to automatically phone home for updating the instance state when it’s done  Background listener to passively waiting on MQ for Smart Agent’s phone home messages  A direct consumer is instantiated at the API Sever at its starting time
  • 9. Phone-Home Call (rpc.listen) Hostname = “host1” API Server 1 SmartAgent Exchange Routing Key Hostname = API Server 2 = Name = “host2” “phonehome” “phonehome” SmartAgent Type = “direct” Hostname = API Server N “hostN” SmartAgent
  • 10. Topic Publisher  Topic Publisher used for both rpc.call() and rpc.cast()  Instantiated and used to push a message to the RabbitMQ  Every publisher connects always to the same topic-based exchange  Life-cycle is limited to the message delivery
  • 11. Topic Consumer • Used to receive messages from RabbitMQ sent by both rpc.call and rpc.cast • Instantiated by Agent instance and exists throughout Agent instance’s life-cycle • Connects to the same topic-based exchange either via a shared queue or via a unique exclusive queue • Every Agent has two topic consumers – One for rpc.cast and it connects to a shared queue – One for rpc.call and it connects to a unique queue • Used by Agent to invoke the appropriate action based on the request coming in
  • 12. Direct Consumer  Used for receiving the response message from Agent  Comes to life only when rpc.call operation is executed  Instantiated and used to receive response message from the queuing system  Every consumer connects to a unique direct-based exchange via a unique exclusive queue named by message UUID  Life-cycle of the queue limited to the message delivery  The exchange and queue identifiers are determined by a UUID generator, and are marshaled in the message sent by the Topic Publisher (only rpc.call operations)
  • 13. Direct Publisher • Used by Agent Server to return the message required by the request operation • Comes to life only during rpc.call operations • Connects to a direct-based exchange whose identity is dictated by the incoming message UUID • Life-cycle is limited to the message delivery
  • 14. Topic Exchange • On RabbitMQ Server • The Exchange is a routing table that exists in the context of a virtual host (the multi- tenancy mechanism provided by RabbitMQ); its type (such as topic vs. direct) determines the routing policy; a RabbitMQ node will have only one topic-based exchange for every topic in Nova.