Add flush endpoint
This commit is contained in:
parent
0c22f3b09f
commit
df920af3e8
|
@ -7,6 +7,7 @@ module Burlesque
|
|||
|
||||
PUB_ENDPOINT = '/publish'
|
||||
SUB_ENDPOINT = '/subscribe'
|
||||
FLUSH_ENDPOINT = '/flush'
|
||||
STATUS_ENDPOINT = '/status'
|
||||
DEBUG_ENDPOINT = '/debug'
|
||||
OK = 'OK'
|
||||
|
@ -33,6 +34,16 @@ module Burlesque
|
|||
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
|
||||
req = Net::HTTP::Get.new(STATUS_ENDPOINT)
|
||||
res = http.request(req)
|
||||
|
|
Loading…
Reference in New Issue