Giter Club home page Giter Club logo

rabbitmqtutorial's Introduction

Rabbitmq Bundle Tutorial

========================

Questo tutorial ha lo scopo di guidare per esempi nell'utilizzo pratico di RabbitMQ, broker di messaggi asincroni, con il bundle in questione basato su framework Symfony 2.1.

https://github.com/videlalvaro/RabbitMqBundle

In pratica illustra le possibilità di comunicazione asincrona fra processi, illustrandone le varie casisitiche, il tutto sfruttando le potenzialità del bundle che mascherano l'interazione con le API del protocollo ** Advanced Message Queuing Protocol ** per interagire con il Message Broker.

Nei vari branch sono presenti esempi in base alle tipologie di comunicazione.

  1. Installare RabbitMQ

Installare il server di messaggistica seguendo le istruzioni per il proprio SO dal [sito ufficiale] 1

Altre info:

  • [** Concetti base **] 3
  • [** Plugin **] 4
  • [** RabbitMQ in Action - Distributed messaging for everyone **] 5

attivare il server:

>sudo service rabbitmq-server start

La console è raggiungibile all'url:

http://localhost:15672/#/

Verifica dell'installazione del web server, come da manuale symfony, occhio ai folder log e cache:

http://symfony.com/doc/current/book/installation.html

nel tutorial il virtual host del web server è configurato con il nome

http://rabbitmq-tutorial.localhost/

In ogni branch puoi verificare le funzionalità esposte dalla homepage:

http://rabbitmq-tutorial.localhost/app_dev.php

  1. Branch queue

un producer, un consumer scenario 1

attiva consumer da shell

>php app/console rabbitmq:consumer custom_message

attiva il producer

http://rabbitmq-tutorial.localhost/app_dev.php/produce/ciao/mondo

un producer, due consumer scenario 2

attiva altro consumer con un'altra shell

 >php app/console rabbitmq:consumer custom_message

attiva il producer per inviare due messaggi

http://rabbitmq-tutorial.localhost/app_dev.php/produce/ciao/mondo/2

Publish/Subscribe scenario 3

attiviamo due distinti consumer via shell

 >php app/console rabbitmq:consumer custom_message
 >php app/console rabbitmq:consumer another_custom_message

attiva il producer per inviare un solo messaggio

http://rabbitmq-tutorial.localhost/app_dev.php/produce/ciao/mondo

  1. Branch queue con routing key

producer con consumer selettivi scenario 4

attiva consumer per messaggi di tipo sms da shell

 >php app/console rabbitmq:consumer rk_sms_custom_message

attiva consumer per messaggi di tipo mail da shell

 >php app/console rabbitmq:consumer rk_mail_custom_message

attiva il producer con routing key mail

http://rabbitmq-tutorial.localhost/app_dev.php/rouningKey/ciao/mondo/delivery.mail

attiva il producer con routing key mail

http://rabbitmq-tutorial.localhost/app_dev.php/rouningKey/ciao/mondo/delivery.sms

puoi specificare il routing key come parametro al consumer da command line

 >php app/console rabbitmq:consumer --route "delivery.sms" rk_custom_message
  1. Branch Remote Procedure Call (RPC)

Simple RPC (Request/reply) scenario 6

attiva server rpc da shell

 > php app/console rabbitmq:rpc-server random_int

attiva la request

http://rabbitmq-tutorial.localhost/app_dev.php/simpleRpc

Parallel RPC

attiva server RPC da shell, service A

 > php app/console rabbitmq:rpc-server service_a

attiva server RPC da shell, service B

 > php app/console rabbitmq:rpc-server service_b

attiva la request

http://rabbitmq-tutorial.localhost/app_dev.php/parallelRpc

  1. Branch Topic

Topic (Publish/Subscribe) scenario 5

attiva consumer su tutti i messaggi del topic da shell

 > php app/console rabbitmq:anon-consumer -m 10 logs_watcher

attiva consumer dei soli messaggi error del topic da shell

 > php app/console rabbitmq:anon-consumer -m 10 -r "#.error" logs_watcher

Invia messaggio di info, consumato solo dal generico consumer

http://rabbitmq-tutorial.localhost/app_dev.php/log/message.info/registration.ok/1

Invia messaggio di error, consumato da entrambi i consumer

http://rabbitmq-tutorial.localhost/app_dev.php/log/message.error/registration.ko/1

  1. Branch STDIN PRoducer

attiva consumer da shell

 > php app/console rabbitmq:consumer stdin_message

attiva producer da shell che invia il contenuto di un files

 > php app/console rabbitmq:stdin-producer words < message.txt

rabbitmqtutorial's People

Watchers

James Cloos avatar Matteo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.