7. seriously, what’s full-stack-bus?
By uniting frontend and backend bus
technologies we can create
applications that work out together in
a decoupled fashion.
frontend => frontend
frontend => backend
backend => frontend
backend => backend
8. … but I already do that!!!!
frontend => frontend: eventEmitters, listeners, global variables...
frontend => backend: HTTP, Websockets...
backend => frontend: Websockets, Long-polling...
backend => backend : HTTP, sockets, shared Db...
Some of this are good
mechanisms.
...others are just
antipatterns…
Unifying approachs has
its own beauty.
9. why then, a message bus?
Message bus allow to offer decoupled
interfaces, based in Events/Messages.
No callbacks, no request-reply,
producers and consumers are decoupled.
Off-the-shelf communication patterns:
topics, queues, ...
10. is it for me?
Probably not. Message bus is not
everybody’s cup of tea.
If your platform is growing a lot in
terms of load and/or complexity then
it will help.
11. can we now start with the tech?
This is one possible way to
communicate all your applications.
postal.js
js
module
js
module
js
module
RabbitMQ
STOMP
over
Websokets
(SockJS)
μService μService μService
12. RabbitMQ
RabbitMQ is a Message Broker
implementing of the AMQP protocol. [4]
Fast and easy to use.
Open source :-)
Almost certainly it is supported in your language /
platform
Very advanced concepts:
● Messaging: exchanges, queues, routing, …
● Built-in clustering and replication
[4] http://www.rabbitmq.com
13. Postal.js
JS pub/sub library supporting some advanced
subscription features [5]
➔ in-memory message bus - very loosely inspired by AMQP
➔ runs in the browser, or on the server using node.js
➔ only pub/sub, no queues
➔ opensource (> 1K in github)
[5] https://github.com/postaljs/postal.js
14. javascript
Javascript is THE full-stack language: runs on
the client, server, databases and even on a
toaster [6]
[6] http://bit.ly/1uX9s44
In our sample game:
➔ node.js: μ-services
➔ angular: almost magical binding
.js
15. STOMP SockJS
[7] http://stomp.github.io/
[8] https://github.com/sockjs
[9] http://www.rabbitmq.com/web-stomp.html
STOMP Simple Text
Orientated Messaging
Protocol [7].
STOMP clients communicate
with any STOMP message
broker (eg. RabbitMQ).
SockJS is a browser JS
library that provides a
WebSocket-like object [8]
SockJS uses native
WebSockets or a variety of
browser-specific transport
protocols.
RabbitMQ provides a plugin that implements STOMP over
SockJS: Web-Stomp plugin [9].
It is very simple to setup and use.
16. full-stack-bus ballgame example
application example: multiplayer ping-pong
[10] https://github.com/javierarilos/full-stack-bus-ballgame
postal.js
classi
ficati
on
game
log
ball
mgmt
score
aggregator
μService