Giter VIP home page Giter VIP logo

rabbit-learning's Introduction

Run a Rabbitmq server on ubuntu

You can run a rabbitmq server on your ubuntu with one of following ways:

1) Run as sysmtemctl services

Because rabbitmq uses erlang/otp you should install erlang first:

Through this link you can install erlang on your ubuntu.

After you installed erlang now you can install rabbitmq with following link link. You should follow only steps 2 and 3.

2) Run with docker

With following command you will have a rabbitmq server that has admin api and amqp protocol with 5672 and 15672 ports.

$ docker run --name="rabbitmq" -d -p 15672:15672 -p 5672:5672 rabbitmq:3.8-management-alpine

Interact with rabbitmq queues

1) Laravel

We have 2 basic produce and consume commands that is created with laravel's artisan console and they are defined in: app/Console/Commands/Rabbit directory.

Publish

After running a rabbitmq server, now you can publish messages to server with this command:

php artisan rabbit:publish {queue-name} {message-body}

Consume

And also you can consume messages and see them with following command:

php artisan rabbit:consume {queue-name}

2) Terminal

You can interact with rabbitmq server with rabbitmqadmin command in terminal.

To have a basic interact with rabbtiqn first you must declare a queue with a name:
rabbitmqadmin declare queue name=sms durable=false

and in the output you must see:
queue declared

You can see list of queues with following command:
rabbitmqadmin list queues

After you created queue now you can publish a message to your queue:
rabbitmqadmin publish routing_key=sms payload="hello, world"

You can see list of messages that is published to queue:
rabbitmqadmin get queue=sms

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.