Skip to content

Commit

Permalink
Get the queue dest paths right
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Sep 19, 2015
1 parent a783a89 commit 09eebf9
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions code/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -894,20 +894,26 @@ def gen_full_msg_id(msg)
end

def gen_full_dest(msg)
res = {
'dest' => "http://#{@host}:#{@port}/q/#{msg['dest']}/",
'queue' => msg['dest']
}

# IF message already has full remote dest...
if msg['dest'].start_with?('http:')
res['dest'] = msg['dest']
q_name = msg['dest'][/\/q\/([^\/]+)/, 1]
res['queue'] = q_name
#msg_id = msg['dest'][/\/q\/[^\/]+\/([^\/]+)/, 1]
case msg['dest']
when /^http:/
# If message already has dest url...
{
'dest' => msg['dest'],
'queue' => msg['dest'][%r{/q/([^\/]+)}, 1],
}
when %r{^/q/}
# If message already has dest path...
{
'dest' => "http://#{@host}:#{@port}#{msg['dest']}",
'queue' => msg['dest'][%r{/q/([^\/]+)}, 1],
}
else
# Bare queue name
{
'dest' => "http://#{@host}:#{@port}/q/#{msg['dest']}",
'queue' => msg['dest'],
}
end

res
end

def attach_msg(msg)
Expand Down

0 comments on commit 09eebf9

Please sign in to comment.