Presentation of ZebroGaMQ

publicité
Presentation of ZebroGaMQ
Denis Conan, Gabriel Adgeg, Michel Simatic
Séminaire INF
Juin 2012
Presentation of ZebroGaMQ
Outline
1
2
3
4
Use case: Mobile Mixed Reality Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Advanced Message Queuing Protocol. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5
ZebroGaMQ: Communication Middleware for Mobile Gaming . . . . . . . . . . . . . . . . . . . . . 12
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 2/13
Presentation of ZebroGaMQ
1 Use case: Mobile Mixed Reality Games
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 3/13
Presentation of ZebroGaMQ
2 Requirements
Point-to-point and broadcast messages
Notifications, requests—responses, short and large messages
Presence service, disconnection management, scalable
Java clients on Android, JavaScript clients for Web clients, Python clients on game
server
Standard based
Easy set up and deployment, and Cloud support
Optional: persistent messages, FIFO, encryption
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 4/13
Presentation of ZebroGaMQ
3 Advanced Message Queuing Protocol
3.1
3.2
3.3
3.4
3.5
3.6
Presentation of Advanced Message Queuing Protocol. . . . . . . . . . . . . . . . . . . . . . . . . . . .6
AMQP concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
Message Queue, exchange, and keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Notification filtering mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Exchange types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Presentation of RabbitMQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 5/13
Presentation of ZebroGaMQ
3 Advanced Message Queuing Protocol
3.1 Presentation of Advanced Message Queuing Protocol
AMQP: open standard for messaging middleware
Version 0.9.1 released on December 2006
October 2011, version 1.0, but no backwards compatibility
https://www.amqp.org
Enables APIs for Java, C, C++, Python, C# or many other language on
GNU/Linux, Solaris, Windows, Z/OS, etc.
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 6/13
Presentation of ZebroGaMQ
3 Advanced Message Queuing Protocol
3.2 AMQP concepts
Exchange
"MyExchange"
Routing / Bindig key
"MyRoutingKey"
Queue
"MyQueue"
Producer
Consumer
type=direct
Virtual host
"MyVirtualHost"
AMQP is mainly one-broker-centered
Some implementations like RabbitMQ provide clustering facilities
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 7/13
Presentation of ZebroGaMQ
3 Advanced Message Queuing Protocol
3.3 Message Queue, exchange, and keys
Properties of message queues:
Lifespan:
I Durable = last until they are deleted
I Temporary = last until the broker shuts down
I Auto-deleted = last until they are no longer used
Two acknowledgment models:
1. Automatic: broker removes a content as soon as it delivers it to a consumer
2. Explicit: the consumer must send Ack methods
Exchanges = matching and routing engines
Binding = relationship between a message queue and an exchange
Criteria for routing = bindings
Routing key = header field examined by the exhange for routing
When binding a message queue to an exchange, another key is given:
I Binding key = parameter used by the exchange to configure the routing
protocol
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 8/13
Presentation of ZebroGaMQ
3 Advanced Message Queuing Protocol
3.4 Notification filtering mechanisms
The notification filtering mechanisms are specified via the exchange types
Channel-based filtering is available
Subject-based filtering is available
Type-based filtering not allowed in AMQP
Messages are arrays of bytes, not objects in the OO acceptation
Content-based filtering is not natively provided in the implementation we have
choosen (RabbitMQ)
Routing key is the only part of the header used for routing
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 9/13
Presentation of ZebroGaMQ
3 Advanced Message Queuing Protocol
3.5 Exchange types
Fanout exchange type implements channel-based filtering
1. Message queue binds to exchange with no arguments
2. Publisher sends to the exchange message m
3. m is passed to message queue unconditionally
Direct exchange type
1. Message queue binds to exchange using routing key K
2. Publisher sends to exchange message m with the routing key R.
3. m is passed to message queue if K = R.
Topic exchange type implements subject-based filtering
1. Message queue binds to exchange using a binding key B as the routing pattern
2. Publisher sends to exchange message m with routing key R.
3. m is passed to message queue if R matches B.
Routing key = zero or more words delimited by dots
* matches a single word and # matches zero or more words
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 10/13
Presentation of ZebroGaMQ
3 Advanced Message Queuing Protocol
3.6 Presentation of RabbitMQ
http://www.rabbitmq.com, AMQP specification, version 0.9.1
Mozilla Public License, very active project
Supported by SpringSource, a division of VMware
Through adapters, supports XMPP, SMTP, STOMP and HTTP
Core of the broker programmed in Erlang
Clients exist for Java, Ruby, Python, .NET, PHP, Perl, C/C++, Erlang, Lisp, and
Haskell
Many operating systems: Unix-like OSes, Windows, MacOSX, and OpenVMS
Clustering facilities
Amazon EC2 Ubuntu AMIs
Book by A. Videla and J. Williams: “RabbitMQ in Action”, 2011, Manning
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 11/13
Presentation of ZebroGaMQ
4 ZebroGaMQ: Communication Middleware for Mobile Gaming
TOTEM: Theories and Tools for Dist. Authoring of Mobile Mixed Reality Games
http://www.totem-games.org/?q=Communication%20Middleware
ZebroGaMQ: https://github.com/simatic/ZebroGaMQ
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 12/13
Presentation of ZebroGaMQ
4 ZebroGaMQ: Communication Middleware for Mobile Gaming
4.1 ZebroGaMQ contribution
High-level API for gaming
Logging using XML-RPC
Playing using AMQP
State machine in Java, JavaScript, and Python
Presence service
Télécom SudParis, CNRS UMR SAMOVAR — Denis Conan, Gabriel Adgeg, Michel Simatic — Juin 2012 — Séminaire INF 13/13
Téléchargement