Support default exchange routing in Basic_publish
This commit is contained in:
parent
5f250c7f90
commit
560febdea3
|
@ -336,9 +336,14 @@ let handle_method conn channel m =
|
|||
| Basic_publish (exchange, routing_key, false, false) ->
|
||||
lwt (_, (body_size, properties)) = next_header conn in
|
||||
lwt body = recv_content_body conn body_size in
|
||||
let (pseudotype, sink, name) =
|
||||
if exchange = ""
|
||||
then ("Queue", routing_key, "")
|
||||
else ("Exchange", exchange, routing_key)
|
||||
in
|
||||
(match_lwt
|
||||
Node.post' exchange
|
||||
(Sexp.Str routing_key)
|
||||
Node.post' sink
|
||||
(Sexp.Str name)
|
||||
(Sexp.Hint {Sexp.hint = Sexp.Str "amqp";
|
||||
Sexp.body = Sexp.Arr [Sexp.Str exchange;
|
||||
Sexp.Str routing_key;
|
||||
|
@ -347,7 +352,7 @@ let handle_method conn channel m =
|
|||
(Sexp.Str "")
|
||||
with
|
||||
| true -> return ()
|
||||
| false -> send_warning conn not_found ("Exchange "^exchange^" not found"))
|
||||
| false -> send_warning conn not_found (pseudotype^" '"^sink^"' not found"))
|
||||
| Basic_ack (delivery_tag, multiple) ->
|
||||
return ()
|
||||
| _ ->
|
||||
|
|
Loading…
Reference in New Issue