Skip to content

Commit

Permalink
Change log updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Klishin committed Feb 27, 2013
1 parent aad18c2 commit 5054645
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions ChangeLog.md
@@ -1,5 +1,74 @@
## Changes between Langohr 1.0.0-beta11 and 1.0.0-beta12

### Clojure-friendly Return Values

Previously functions such as `langohr.queue/declare` returned the underlying
RabbitMQ Java client responses. In case a piece of information from the
response was needed (e.g. to get the queue name that was generated by
RabbitMQ), the only way to obtain it was via the Java interop.

This means developers had to learn about how the Java client works.
Such responses are also needlessly unconvenient when inspecting them
in the REPL.

Langohr `1.0.0-beta12` makes this much better by returning a data structure
that behaves like a regular immutable Clojure map but also provides the same
Java interoperability methods for backwards compatibility.

For example, `langohr.queue/declare` now returns a value that is a map
but also provides the same `.getQueue` method you previously had to use.

Since the responses implement all the Clojure map interfaces, it is possible to use
destructuring on them:

``` clojure
(require '[langohr.core :as lhc])
(require '[langohr.queue :as lhq])

(let [conn (lhc/connect)
channel (lhc/create-channel conn)
{:keys [queue] :as declare-ok} (lhq/declare channel "" :exclusive true)]
(println "Response: " declare-ok)
(println (format "Declared a queue named %s" queue)))
```

will output

```
Response: {:queue amq.gen-G9bmz19UjHLBjyxhanOG3Q, :consumer-count 0, :message_count 0, :consumer_count 0, :message-count 0}
Declared a queue named amq.gen-G9bmz19UjHLBjyxhanOG3Q
```

### langohr.confirm/add-listener Now Returns Channel

`langohr.confirm/add-listener` now returns the channel instead of the listener. This way
it is more useful with the threading macro (`->`) that threads channels (a much more
common use case).

### langohr.exchange/unbind

`langohr.exchage/unbind` was missing in earlier releases and now added.

### langohr.core/closed?

`langohr.core/closed?` is a new function that complements `langohr.core/open?`.

### langohr.queue/declare-server-named

`langohr.queue/declare-server-named` is a new convenience function
that declares a server-named queue and returns the name RabbitMQ
generated:

``` clojure
(require '[langohr.core :as lhc])
(require '[langohr.queue :as lhq])

(let [conn (lhc/connect)
channel (lhc/create-channel conn)
queue (lhq/declare-server-named channel)]
(println (format "Declared a queue named %s" queue))
```

### More Convenient TLS Support

Langohr will now correct the port to TLS/SSL if provided `:port` is
Expand Down

0 comments on commit 5054645

Please sign in to comment.