Go & RabbitMQ

It's bunnies, all the way down...

(This presentation made with Landslide.)

Golang

Presenter Notes

What we do

Cat

Presenter Notes

What we own

  • Integration of internal and external systems

  • Financial and supply-chain data

  • Order fulfillment process

  • Inventory

Presenter Notes

What we care about

  • Scalability
    • Latency tolerance
    • Throughput
    • Reducing uptime cost (through small, efficient, applications
  • Decoupling systems

  • Developer happiness

  • Data integrity

Presenter Notes

Why messaging queues

  • Scalability
    • easy to scale consumers horizontally
  • Decoupling systems

    • standardize communication between systems
    • application isolation
  • Data integrity

    • message guarantees

Presenter Notes

Why RabbitMQ

  • Message durability and routing

  • Copious language bindings

  • Clustering and high availibity support

  • Flexible messaging patterns

Presenter Notes

Why Go

  • Scalability
    • fast
    • small footprint
  • Data integrity

    • static typing
  • Developer happiness

    • small language
    • batteries included
    • tooling
    • c integration
    • community

Presenter Notes

Producer

Writes 10 messages to the example exchange

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
connection, _ := amqp.Dial(amqpURI)

channel, _ := connection.Channel()

for i := 0; i < 10; i++ {
    channel.Publish(
        "example", //exchange
        "hello.world", //routingKey
        false,
        false,
        amqp.Publishing{
            Headers: amqp.Table{},
            ContentType: "text/plain",
            ContentEncoding: "UTF-8",
            Body: []byte("Hi"),
            DeliveryMode: amqp.Transient,
            Priority: 0,
        },
    )
}

Presenter Notes

Consumer

Reads from the example_queue forever

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
c.conn, _ = amqp.Dial(amqpURI)

c.channel, _ = c.conn.Channel()

deliveries, _ := c.channel.Consume(
    "example_queue", //queue
    c.tag,
    false,
    false,
    false,
    false,
    nil)

for d := range deliveries {
    log.Printf("got %s", d.Body)
}

Presenter Notes

Why our architecture

  • Scalability
    • small, single-purpose applications
  • Decoupling systems

    • application isolation
    • testing
  • Data integrity

    • message idempotence

Presenter Notes

Architecture

Architecture

Presenter Notes

References

Presenter Notes

Bunnies

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
       ,_ ,_        (\/)    _, _,
       | '. '.       \/   .' .' |
       \   \  \          /  /   /
        '.__\_|_        _|_/__.'
            /`  '.    .'   `\
           /    ^ )  ( ^     \
          /   __.'    '.__    \
        .'   (_          _)    '.
      .'      \'-._  _.-'/       '.
     /         '.__)(__.'          \
    ;        .-. '.  .' .-.         ;
  /`|       /   '._)(_.'   \        |`\
 |   \     /--.          .--\      /   |
  '--'\   '-.__)        (__.-'    /'--'
   jgs )_____)            (______(

Presenter Notes