Comments (4)
Hi there,
I tried to follow the example you have here, I have little issue in this part of code.
-- -- Created by IntelliJ IDEA. -- User: ismael -- Date: 19/05/17 -- Time: 17:17 -- To change this template use File | Settings | File Templates. -- local producer = require "rabbitmq" local cjson = require "cjson" local opts = { username = "admin", password = "desarrollo", vhost = "/" } local mq, err = producer:new(opts) if not mq then ngx.say(cjson.encode({ success = false, code = 0, data = { message = "Attempt to connect with rabbit failed. " } })) return end mq:set_timeout(10000) local ok, err = mq:connect("127.0.0.1", 61613) if not ok then ngx.say(cjson.encode({ success = false, code = 1, data = { message = err } })) return end local msg = { success = true, code = 2, data = { message = "All is fine!" } } local headers = {} headers['destination'] = "/exchange/test/binding" headers['receipt'] = "msg#1" headers['app-id'] = "luaresty" headers['persistent'] = "true" headers['content-type'] = "application/json" local ok, err = mq:send(cjson.encode(msg), headers) if not ok then ngx.say(cjson.encode({ success = false, code = 3, data = { message = err } })) return end ngx.log(ngx.INFO, "Published : " .. cjson.encode(msg) ) local headers = {} headers["destination"] = "/amq/queue/lua-queue" headers["persistent"] = "true" headers["id"] = "123" local ok, err = mq:subscribe(headers) if not ok then ngx.say(cjson.encode({ success = false, code = 4, data = { message = err } })) return end ngx.log(ngx.INFO, "Ok: " .. ok) local data, err = mq:receive() if not data then ngx.say(cjson.encode({ success = false, code = 5, data = { message = err } })) return end ngx.log(ngx.INFO, "Consumed: " .. data)local data, err = mq:receive() if not data then ngx.say(cjson.encode({ success = false, code = 5, data = { message = err } })) return endI cand send messages to rabbit well, to prove that I have the following information in nginx logs.
[lua] queu.lua:75: Published : {"data":{"message":"All is fine!"},"code":2,"success":true}
In my browser I'm getting this. It appears the connection with rabbit has been close earlier, but I don't know why.
{"data":{"message":"closed"},"code":5,"success":false}
What am I doing wrong?
What am I missing?
i have a same problem
from lua-resty-rabbitmqstomp.
the same issue
from lua-resty-rabbitmqstomp.
cc @ankneo
from lua-resty-rabbitmqstomp.
PRs are welcome. The project is not actively used anymore internally, hence no more commits by Wingify.
from lua-resty-rabbitmqstomp.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-resty-rabbitmqstomp.