hreinhardt/amqp — pull request #22 by gseitz (2013-09-17 21:44:50+00:00)
Title: Capture connection parameters as ConnectionOpts.

Various connection related parameters are now captured in `ConnectionOpts` as discussed in #17, with the following addition:

The host/port field is of type `[(String, PortNumber)]`, which allows to specify several hosts in a cluster of brokers. The first successful connection will be used.

Given this list of hosts
```haskell
defaultConnectionParams {
cpCluster = [("127.0.0.1", 1742), ("localhost", 1337), ("localhost", 5672)]
}
```

Successful connection (the last connection details were valid and a consumer was started):
```
*Example> main
Error connecting to ("127.0.0.1",1742): connect: does not exist (Connection refused)
Error connecting to ("localhost",1337): connect: does not exist (Connection refused)

connection closed
```

Failed connection without the broker running:
```
Error connecting to ("127.0.0.1",1742): connect: does not exist (Connection refused)
Error connecting to ("localhost",1337): connect: does not exist (Connection refused)
Error connecting to ("localhost",5672): connect: does not exist (Connection refused)
*** Exception: ConnectionClosedException "Could not connect to any of the provided brokers: [(\"127.0.0.1\",1742),(\"localhost\",1337),(\"localhost\",5672)]"
```