Home >Technology >RabbitMQ: Message queuing that works

RabbitMQ: Message queuing that works

Date post:11-Apr-2017
Category:
View:170 times
Download:1 times
Share this document with a friend
Transcript:
  • www.erlang-solutions.com

    RABBITMQ Message queuing that works

  • www.erlang-solutions.com

    Gabriele Santomaggio

    [email protected]m

    Working at Erlang Solutions RabbitMQ contributor Co-author of RabbitMQ Cookbook @gsantomaggio

    mailto:[email protected]://www.erlang-solutions.comhttp://www.erlang-solutions.com

  • www.erlang-solutions.com

    What is RabbitMQ ?

    Multi-protocol Messaging broker Written in Erlang

    Producer

    Consumer

    Exchange

    Queue

    Server

    Virtual host

    Binding

  • www.erlang-solutions.com

    Protocols

    AMQP 0-9-1 MQTT STOMP AMQP 1.0 HTTP

  • www.erlang-solutions.com

    RabbitMQ CLIENTS

    Java .NET/C# Client Python PHP Erlang Node.js iPhone (Dev in progress) Others

  • www.erlang-solutions.com

    1. Create team ("my_company")

    2. Create different rooms ("tech.programming", "tech.networking","marketing")

    3. Send message to the room4. Send private messages5. Store messages6. Clustering / HA

    Messaging - example

    GOALS

  • www.erlang-solutions.com

    What we need

    my_company

    App. client 1

    App. client 2

    Db - service 1

    App 1

    App 2

    Db - service 2Exchange

    Persistent Queue

    Temporary Queues

    Db - service n

  • www.erlang-solutions.com

    R1: Create team

    exchange_declare(exchange="my_company", exchange_type="topic")

  • www.erlang-solutions.com

    R2: Room subscribe

    queue_declare(exclusive=True, auto_delete=True)

    queue_bind(exchange="my_company", queue=queue,

    routing_key="tech.programming")

    basic_consume(on_message, queue=queue, no_ack=True)

  • www.erlang-solutions.com

    headers = { 'sender_user':my_user_name, 'sent': datetime.datetime.now(), 'is_private': False}properties = pika.BasicProperties( headers=headers)

    channel.publish(exchange="my_company", routing_key="tech.programming" properties=properties, body="I love Erlang!")

    R3: Send message to the room

  • www.erlang-solutions.com

    headers = { 'sender_user':my_user_name, 'sent': datetime.datetime.now(), 'is_private': True}properties = pika.BasicProperties( headers=headers)

    channel.publish(exchange="my_company", routing_key="gabriele",

    properties=properties, body="how are you? :)!")

    R4: Send private message

  • www.erlang-solutions.com

    R5: Store messages

    channel.queueDeclare("store.messages", true, false, false, null);

    channel.queueBind("store.messages", "my_company", "#");

    channel.basicQos(1);// round robin channel.basicConsume("store.messages", new DefaultConsumer()...

  • www.erlang-solutions.com

    Oh no seems so complex!!

    R6: Distributed RabbitMQ

  • www.erlang-solutions.com

    rabbitmqctl stop_app rabbitmqctl reset rabbitmqctl join_cluster [email protected]

    rabbitmqctl start_app

    Clustering!

  • www.erlang-solutions.com

    High Availability

    Healthy Cluster

    One Node Down

  • www.erlang-solutions.com

    R6: Done!

    We finished the app

  • www.erlang-solutions.com

    What about WAN configuration?

  • www.erlang-solutions.com

    Federation/Shovel - Plugin

    Loose coupling WAN-friendly Tolerant to network failures

    Node 1 Node 2AMQP client

  • www.erlang-solutions.com

    Cloud scaling...

    Db - Service Db - Service Db - Service

    store.messages - HA

    Client 1 Client 2 Client..n

  • www.erlang-solutions.com

    Exchange messages

  • www.erlang-solutions.com

    Store Messages

  • www.erlang-solutions.com

    Full example

    Full description(soon...I hope:)) https://www.erlang-solutions.com/blog.html

    Source code (other languages)https://github.com/Gsantomaggio/rabbitmqexample

  • www.erlang-solutions.com

    THANK YOU!

    Any questions?

    [email protected]m @gsantomaggio

    mailto:[email protected]://www.erlang-solutions.comhttp://www.erlang-solutions.com

Click here to load reader

Reader Image
Embed Size (px)
Recommended