From 3e3bd483a9182a0fad19f683ef531915eaabd144 Mon Sep 17 00:00:00 2001 From: root <“zy_2626@163.com”> Date: Tue, 11 Feb 2020 18:14:46 +0800 Subject: [PATCH] add queuepublish method --- src/nats.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/nats.lua b/src/nats.lua index fe9236e..db254bd 100644 --- a/src/nats.lua +++ b/src/nats.lua @@ -380,6 +380,18 @@ function command.publish(client, subject, payload, reply) }) end +function command.queuepublish(client, subject, queue, payload, reply) + if reply ~= nil then + reply = ' '..reply + else + reply = '' + end + request.raw(client, { + 'PUB '..subject..reply..' '..queue..' '..#payload..'\r\n', + payload..'\r\n', + }) +end + function command.wait(client, quantity) quantity = quantity or 0 @@ -408,6 +420,7 @@ nats.commands = { subscribe = command.subscribe, unsubscribe = command.unsubscribe, publish = command.publish, + queuepublish= command.queuepublish, wait = command.wait, }