amqp-cgi-bridge

command module
v0.0.0-...-81c1230 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2018 License: MIT Imports: 10 Imported by: 0

README

AMQP FastCGI bridge

AMQP FastCGI bridge is an AMQP consumer which consumes messages from AMQP server and process them using FastCGI server. It was built to address problems of consuming AMQP messages with PHP. More information.

Install

You can download binary from GitHub release page, or using go get:

go get github.com/skolodyazhnyy/amqp-cgi-bridge

Usage

Application requires simple YAML configuration file which contains AMQP URL and list of queues to consume messages.

# AMQP URI (see https://www.rabbitmq.com/uri-spec.html)
amqp_url: "amqp://localhost"

# an array of consumers
consumers:
  - # a queue to consume messages
    queue: "messages"
    # address of FastCGI server and name of the script to run to process messages
    fastcgi:
      net: "tcp"
      addr: "127.0.0.1:9000"
      script_name: "/path/to/script.php"
    # number of messages to be processed in parallel
    parallelism: 10
    # prefetch value for consumer (if not specified, same as parallelism)
    prefetch: 10
    # additional environment variables
    env:
      QUEUE_NAME: "messages"

Then, you need to configure and start PHP-FPM server (or any other FastCGI server) to process messages.

Your PHP script to process messages will work more or less same way as with Web Server, message body will be delivered in request body, and AMQP headers will be available through $_SERVER variable.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL