lfex / kanin

An LFE Wrapper for the Erlang RabbitMQ (AMQP) Client
Apache License 2.0
7 stars 2 forks source link

Examine kanin-supported AMQP commands to determine wrapper feasibility #36

Open oubiwann opened 7 years ago

oubiwann commented 7 years ago

Possible strategy (looking at https://github.com/lfex/kanin/blob/master/include/rabbit-framing.lfe):

Part of epic #35

oubiwann commented 7 years ago

Current usage in kanin looks like this:

(kanin:call
  (make-queue.bind
    queue example-queue
    exchange example-exchange
    routing_key example-key))
oubiwann commented 7 years ago

One possible outcome could be calls that look like this:

(kanin:queue.bind
  queue example-queue
  exchange example-exchange
  routing_key example-key))

To support "keyword" args like that, kanin:queue.bind would have to be a macro wrapping the record constructor.

oubiwann commented 7 years ago

A one-off macro for the queue.bind command:

(defmacro queue.bind body
  `(kanin:call
     (make-queue.bind ,@body)))

Called with:

(queue.bind queue #"myq" exchange #"myex" routing_key #"myrk")

It would be nice if record fields could have dashes converted to underscores ...