talked about AMQP a lot. The next development focused on AJAX.
    • read one message from the queue
    • read all messages from the queue
    • find out the length of the queue
    • post a message in exchange

    Data is returned in JSON.


    logfile /usr/local/var/amqp.log; # logfile
    pidfile /tmp/; # pidfile
    log_level notice; # the level of logging: error, notice, warning, debug
    daemon on; # daemon mode
    port 80; # http port, default 80
    http; # bind IP
    amqp: 5672; # amqp connection string psw: login @ host: port / vhost 


    ./amqp-rest [полное имя конфиг-файла]
    ./amqp-rest stop // останавливает сервис
    kill -s HUP `ps | grep amqp-rest | awk '{print $1}'` // перезапуск с новой конфигурацией


    reading one element from the queue, the
    name of the queue is the right part of the url until the last slash. For url / sss / q2, the queue name is “q2”. This is done intentionally, since all urls are hung on a specific location and proxied through nginx. reading all elements from the queue queue size publication The exchange name is also the part of the url between the last slash and '?', and the exchange key is the part of the url, after the question mark. For example, for url : 8080 / sss / ex1? News , the exchange name is “ex1”, and the routing key is “news”
    {"result": "OK", "message":"message 2", size : 2}
    // size - размер очереди, сколько элементов осталось в очереди.

    {"result": "OK", "count" : 2, messages ["message 3","the text\"xxxx\" tttt"]}
    // count - размер массива сообщений.

    {"result": "Ok", "count": 3 }

    curl -d 'some post data'
    {"result": "Ok"}

    Of course, everything is designed for AJAX. nginx stands at the front of the server and proxies requests for amqp-rest. You can do without nginx if you hang them on different IPs. In my case, I use ngx_accesskey_module to protect against spam. Perhaps this functionality will be transferred to amqp-rest in the future.


    that repents of performance: 1300rps
    memory space 601k

    Also popular now: