AMQP exchanges route messages to queues. By default the server will have a
few exchanges declared (including the default exchange ""
), but
additional exchanges can be declared and subsequently deleted by clients.
Both amqp_declare_exchange()
and amqp_delete_exchange()
will
raise errors if there is a problem declaring/deleting the exchange.
amqp_declare_exchange(conn, exchange, type = "direct", passive = FALSE, durable = FALSE, auto_delete = FALSE, internal = FALSE, ...) amqp_delete_exchange(conn, exchange, if_unused = FALSE)
conn | An object returned by |
---|---|
exchange | The name of an exchange. |
type | The type of exchange. Usually one of |
passive | When |
durable | When |
auto_delete | When |
internal | When |
... | Additional arguments, used to declare broker-specific AMQP extensions. See Details. |
if_unused | Delete the exchange only if it is unused (i.e. no queues are bound to it). |
Additional arguments can be used to declare broker-specific extensions. An incomplete list is as follows:
"alternate-exchange"
Specify an alternate exchange to handle messages the broker is unable to route.
if (FALSE) { conn <- amqp_connect() amqp_declare_exchange(conn, "test_exchange", "fanout") amqp_delete_exchange(conn, "test_exchange") amqp_disconnect(conn) }