Git Product home page Git Product logo

rabbitmq-golang-php-microservice's Introduction

Introduction

Make a communication between Golang with PHP by using RabbitMQ as message broker that hosted in CloudAMQP. These days, microservice pattern or concept(you name it) have being spread and used widely because of its advantages over a monolith application. With microservices, we can decoupling the new/exisiting features from main codebase and isolated into its own language(can develop using any programming language besides from our main codebase) or environment without cluttering core codebase.

Terminology

These microservices eventually need to communicate to each other to receive and sending the data from our main application which exposed by HTTP from the outside world. Outside world here can be assumed as a Client(Mobile apps, web application, embedded) make a HTTP call to the backend server. Backend application will handle the rest of operations by distributed the process into multiple form.

Data would be passed to RabbitMQ(message broker) by a producer and the rest of microservices(consumers) will execute the task that exist inside a queue of RabbitMQ. As example, client want to send sms and at the same time send an email to specified member.


                                                  sms process  
                                                     /        \  
                                                    /           \
[Client] --> inititated process sending sms and email                --> pass to Message Broker 
                                                    \            /              |
                                                      \         /               |
                                                  email process           microservices
                                                                                |
                                                                                /\
                                                                               /  \
                                                                              /    \
                                                                        Email(PHP) Sms(Golang)
                                                                        

For the sake of brevity, i just add two simple application that written in PHP and GO react as producer and consumer respectively.

How to Run

Assumed already installed go and php on your local machine. Download this repository, and run these two files using CLI:

  • Configure CloudAMQP setting for both publisher.php and main.go. Using CloudAMQP is optional(register free account at cloudamqp)
  • Run composer install
  • Install amqp for go: go get github.com/streadway/amqp
  • [Producer] - php publisher.php
  • [Consumer] - go run main.go

rabbitmq-golang-php-microservice's People

Contributors

metallurgical avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 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.