Companies looking to speed up their software development are adopting microservices architectures (MSA). Building applications as groups of smaller components with fewer dependencies helps companies such as Comcast, Capital One, Uber, and Netflix deliver more frequent releases and thus innovate faster.
An important consideration in adopting an MSA is deciding how individual services should communicate between each other. Adding a message queue such as RabbitMQ to handle interservice messages can improve communication by:
- Simplifying our services so they only need to know how to talk to the messenger service.
- Abstracting communication by having the messenger service handle sophisticated orchestration patterns.
- Scaling message throughput by increasing the cluster size of the messenger service.
In this webinar we'll discuss:
- Requirements for communicating between microservices
- Typical messaging patterns in microservice architectures
- Use cases where RabbitMQ shines
- How to use the RabbitMQ service for Pivotal Cloud Foundry to deploy and run your applications
We’ll also demonstrate how to deploy RabbitMQ in Pivotal Cloud Foundry, and how to incorporate it in microservices-based applications.
Presenters: Greg Chase, Pivotal and Dan Baskette, Pivotal
4. Why Systems are Evolving to Microservices
Architectures
Characteristics of a
Microservices system:
● Independent executable
component
● Does one thing well
● Often Event & message
driven
● Fault tolerant
● Evolutionary
5. Differentiating Requirements for Communicating
Between Microservices
● Timing: Synchronous, asynchronous, batched, delayed, offline
● Interactions: Notification, acknowledged, request-response, workflow
● Scale: 1000’s messages per second / 10,000’s / 100,000’s
● Cardinality: 1 to 1 or 1 to many?
6. Great for request-response, but can break microservices style
Synchronous Communication Starts Out Simple
Benefits
● Simple and familiar
● Easy to test
● Firewall friendly
● Simpler architecture
Drawbacks
● Server must always send a
response
● Both sender and receiver must
be available
● Not scalable by itself
Trip
Management
Passenger
(mobile)
POST/trips Get/passengers/<passengerID>
REST Passenger
Management
202 OK201 Created
REST
7. More complex to setup but can simplify services, provide scale & resilience
Asynchronous Communications Patterns
Event Log / Topic Firehose Message queues
Two common patterns for handling messaging in MSA:
Producer
Hadoop Apps DBs
9. Open source message broker for communication between decoupled applications
What is RabbitMQ?
Asychronous
Messaging
● Multiple
protocols
● Queues
● Exchanges
Developer
Experience
● Containers
● Configuration
management
● Cross-language
● All major
languages
Distributed
Deployment
● Highly
available
● High scale
● Multi-zone
Enterprise & Cloud
Ready
● Authentication
● Encryption
● Cloud-friendly
Tools & Plugins
● Continuous
integration
● Metrics
● Enterprise
integration
Management &
Monitoring
● HTTP-API
● Command line
● UI tool
10. Exchanges route messages to queues to await delivery
RabbitMQ Concepts
P
C
Exch
C
Producer Exchange:
● Fanout
● Direct
● Topic
● Header
“Foo.bar”
Binding
“*.bar”
“Foo.#”
Queues Consumers
“Meta” match “value”
11. Easy, flexible messaging supporting many message types and routes
Example Patterns for RabbitMQ and Use Cases
Work queues
C
C
General Pub/Sub
C
C
P Exch
Routing
C
C
P Exch
“*.bar”
“Foo.#”
“Meta” match “value”
13. Provide RabbitMQ as a service for your developers
RabbitMQ for Pivotal Cloud Foundry
● Two kinds of deployments
○ Pre-provisioned HA multitenant
RabbitMQ cluster
○ Dedicated single node RabbitMQ
instances
● Developers gain self-service
access to dedicated or vhost
● Monitoring available via RabbitMQ
tools
● RabbitMQ for PCF metrics
exposed to PCF Firehouse
● Automate deployment,
management and monitoring of
RabbitMQ
14. HA RabbitMQ multi tenant cluster or dedicated single nodes
Deploy Two Types for RabbitMQ Services in PCF
● Pre-provision RabbitMQ as highly
available cluster
● Utilize RabbitMQ HAProxies for load
balancing
● Deploy to multiple availability zones
● Simple provisioning through CF CLI
● On demand provisioning of dedicated
RabbitMQ single nodes
● Select maximum service instances to
control consumption of IaaS resources
● Developers have direct access to
RabbitMQ instances
App
Elastic
Runtime
16. An opinionated packaging of RabbitMQ for Cloud Native development
Targeted Use Cases for RabbitMQ for PCF
Inter application messaging Backing service for:
Spring Cloud Services
Spring Cloud Data Flow
17. Quarterly release cadence
Future enhancements of RabbitMQ for PCF
Based on RabbitMQ 3.6.x
Multitenant clusters
Dedicated single node
1.8 1.9 1.10 1.11
Based on RabbitMQ 3.7.x
Dedicated cluster
Ongoing improvements to developer experience and operator automation
This timeline reflects current forecast of product enhancements and may change without notice. These
are not to be construed as committed dates or versions for delivery.
19. FunCollector - Demo App
● Spring Boot microservices based
● Cloud Native and Deployed on Pivotal Cloud Foundry
● Services
‒ RabbitMQ for Publish/Subscribe messaging between components
‒ Pivotal Google Compute Service Broker - Machine Learning API
‒ PostgreSQL Storage
● Each component is independently scalable
● Built to address my “Vice”
20. Web UI
Web UI
Web UI
ImageRecog
Vision APIImageRecog
Vision APIImageRecog
Vision API
PopIdentifier
PopIdentifier
PopIdentifier
Photo Accepted and
Published to VisionReady
Queue as Object with
Bytestream
Photo is consumed
from queue and
forwarded to
Google Vision API
for Text
Recognition
Object is Enhanced with
Metadata and Published to
VisionResults Queue
Metadata is consumed from
queue and evaluated. Then it’s
compared vs. Master List and
item is Identified
Photo is taken by user and
uploaded
TheCollector
Identified item
is published to
Identified
Queue
Queue is consumed and
Database Updated
FunCollector