Amazon SNS/SQS
with Go
MAKING HIGH AVAILABILITY, FAILOVER, ASYNCHRONOUS
COMMUNICATION, AND RELIABLE DELIVERY COME TO LIFE
Slide 2
Slide 2 text
Volunteer
u Mmmmmm, candy….
Slide 3
Slide 3 text
No content
Slide 4
Slide 4 text
No content
Slide 5
Slide 5 text
What will you do about it?
Slide 6
Slide 6 text
Paul Borlin
Slide 7
Slide 7 text
Paul
Borlin
Slide 8
Slide 8 text
No content
Slide 9
Slide 9 text
No content
Slide 10
Slide 10 text
No content
Slide 11
Slide 11 text
No content
Slide 12
Slide 12 text
You Can Sponsor a Child!
u https://compassion.de (Deutschland)
u https://compassionuk.com (United Kingdom)
u http://www.compassion.ie (Ireland)
u https://compassion.it (Italia, España)
u https://compassion.nl (Holland)
u https://www.selfrance.org/ (France)
u https://compassion.no (Nordic)
u https://compassion.se (Sverige)
u https://compassion.ch (Schweiz)
Slide 13
Slide 13 text
What are
we talking
about,
today?
u What are Message Brokers?
u Advantages of using a
message broker
u What is Amazon SNS
u What is Amazon SQS
u Learn how we communicate
to SNS/SQS via Go
Slide 14
Slide 14 text
What is a Message Broker?
Slide 15
Slide 15 text
Message Broker
u A message broker is an intermediary computer program module
that translates a message from the formal messaging protocol of the
sender to the formal messaging protocol of the receiver. Message
brokers are elements in telecommunication or computer networks
where software applications communicate by exchanging formally-
defined messages.
u Analogous to the Postal Service
Slide 16
Slide 16 text
Message Broker
Slide 17
Slide 17 text
Message
Broker –
Sender
Slide 18
Slide 18 text
Message
Broker –
Receiver
Slide 19
Slide 19 text
Message Broker
Slide 20
Slide 20 text
Message Broker
SNS/SQS
Slide 21
Slide 21 text
Why Use a Message Broker??
Slide 22
Slide 22 text
Asynchronous
Communication
u The publisher doesn’t need to
“block” while waiting
u Back-pressure can be regulated
Slide 23
Slide 23 text
Backpressure
Slide 24
Slide 24 text
Backpressure
Real world example
Slide 25
Slide 25 text
Backpressure
Slide 26
Slide 26 text
More About Message Brokers, Very
Quickly….
Slide 27
Slide 27 text
High Availability
u Multiple servers/nodes for one
“broker”
u Servers can be synchronized
u Guaranteed delivery
u Load balancing
u Alive when your back-end
application is not
Slide 28
Slide 28 text
Failover
u Other nodes in the HA cluster
can take over if one goes
down
u No data lost
Slide 29
Slide 29 text
Distribution
u Multiple applications need
the same data
u Publisher doesn’t need to
know who gets it
u No re-deploy or reconfigure
u Handles the distribution in
various modes
u Analogous to passing out
candy
u Event Driven or Reactive
Design Architecture
Slide 30
Slide 30 text
Does no work on data.
Slide 31
Slide 31 text
Applications Contact the Broker, Not the Other Way Around
Application Broker
Slide 32
Slide 32 text
How Does a
Broker
Communicate?
u Protocol Standards
u STOMP
u AMQP
u HTTP / REST
u MQTT
u JMS
u RPC
u OpenWire
u RSS and Atom
u More…..
Slide 33
Slide 33 text
Additional Features
u Retry logic
u Dead Letter Queue
u Time-To-Live (TTL)
u Auto Delete
u Persistence or Transient
u Limits
u Different Types of Distribution
Slide 34
Slide 34 text
Message Brokers on the Market
u Amazon SQS/SNS
u ActiveMQ (Apache)
u Amazon MQ
u Kafka (Apache)
u RabbitMQ (Pivitol)
u BizTalk Server (Microsoft)
u HornetQ (RedHat)
u IBM MQ
u MSMQ (Microsoft)
Slide 35
Slide 35 text
When Not to
Use a Message
Broker
Big Messages
Synchronous Communication Needed
or Desired
It’s Simply Done By Direct
Communication (Don’t over-
architect)
Slide 36
Slide 36 text
Great Uses for
a Message
Broker
Offload work to be done later
Need a quicker response to user
Need to handle
backpressure at various
times of day
Why spin up more nodes if you
don’t need to?
More than one receiver
Slide 37
Slide 37 text
Amazon SNS
(Simple Notification Service)
Slide 38
Slide 38 text
Amazon SQS
(Simple Queueing Service)
Slide 39
Slide 39 text
SQS
SNS
Service
Service
Service Service Service
Slide 40
Slide 40 text
Advantages of Amazon SNS/SQS
Over Other Brokers
u HTTP is simple
u SDK is well built and ready to use
u No need for a “shutdown”
u Hosted for you
Slide 41
Slide 41 text
(Potential) Disadvantages of
Amazon SNS/SQS Versus Other
Brokers
u Polling
u Cost
u May not be as “fast” as other brokers
u Messages have a max life of 14 days
u Need advanced features in other brokers
Slide 42
Slide 42 text
Now, let’s see
something
cool…
Instead of my
PowerPoint.
Slide 43
Slide 43 text
Connect with me
Get the code and slides
u @PaulBorlin
u https://www.linkedin.com/in/paulborlin/
u https://paulborlin.com