Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. ExchangeName = <<"custom.topic">>,
  2. ExchangeType = <<"topic">>,
  3. Key = <<"K">>,
  4. Msg = <<"123">>,
  5. {ok, Connection} = amqp_connection:start
  6. (#amqp_params_network{username = <<"guest">>, password = <<"guest">>, host = "192.168.1.1"}),
  7. {ok, Channel} = amqp_connection:open_channel(Connection),
  8. #'exchange.declare_ok'{} =
  9. amqp_channel:call(Channel, #'exchange.declare'{exchange=ExchangeName, durable=true, type = ExchangeType}),
  10. amqp_channel:call(Channel, #'basic.publish'{routing_key = Key}, #amqp_msg{props = #'P_basic'{delivery_mode=2}, payload = Msg}),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement