Add flush endpoint
This commit is contained in:
parent
0c22f3b09f
commit
df920af3e8
|
@ -7,6 +7,7 @@ module Burlesque
|
||||||
|
|
||||||
PUB_ENDPOINT = '/publish'
|
PUB_ENDPOINT = '/publish'
|
||||||
SUB_ENDPOINT = '/subscribe'
|
SUB_ENDPOINT = '/subscribe'
|
||||||
|
FLUSH_ENDPOINT = '/flush'
|
||||||
STATUS_ENDPOINT = '/status'
|
STATUS_ENDPOINT = '/status'
|
||||||
DEBUG_ENDPOINT = '/debug'
|
DEBUG_ENDPOINT = '/debug'
|
||||||
OK = 'OK'
|
OK = 'OK'
|
||||||
|
@ -33,6 +34,16 @@ module Burlesque
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def flush *queues
|
||||||
|
req = Net::HTTP::Get.new("#{FLUSH_ENDPOINT}?queues=#{queues.join(?,)}")
|
||||||
|
|
||||||
|
begin
|
||||||
|
res = http.request(req)
|
||||||
|
JSON.parse(res.body) if res.is_a? Net::HTTPOK
|
||||||
|
rescue Net::ReadTimeout
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def status
|
def status
|
||||||
req = Net::HTTP::Get.new(STATUS_ENDPOINT)
|
req = Net::HTTP::Get.new(STATUS_ENDPOINT)
|
||||||
res = http.request(req)
|
res = http.request(req)
|
||||||
|
|
Loading…
Reference in New Issue