[rabbitmq-discuss] Draft of C++ rabbitMq API

Tony Garnock-Jones tonyg at lshift.net
Wed Mar 3 23:03:34 GMT 2010


Hi Alexandre,

Thanks for this, it's a great start.

Alexandre Kalendarev wrote:
> Exchange class
> class AMQPExchange {
> 	AMQPExchange( AMQPConnection * cnn );
> 	void Declare(string name);
> 	void Declare(string name, int parms);
> 	void Declare(string name, int parms, map properties ); // *)?
> 	void Delete(string name)
> }

The only question I have is why these are classes. I would have expected
"factory" methods such as Declare to live on AMQPConnection itself. (Do
you intend, by the way, to support multiple channels per connection? I
can't say I recommend it, but for some scenarios it's probably pretty
useful.)

I would have expected something more like:

class AMQPConnection {
  ...
  AMQPExchange *ExchangeDeclare( ... );
  AMQPQueue *QueueDeclare( ... );
  ...
}

class AMQPExchange {
  void Delete();
  void Publish(string routingKey, ...);

  string getName();
  // etc
}

I'm afraid my C++ years are approximately a decade behind me, so please
don't read my suggestions too literally :-) It'll take me a while to get
back up to speed with what's considered good modern C++ style...

(Also, could AMQPExchange be a valuetype? It's pretty tiny, it's
stateless, and it'd be nice to avoid memory-management headaches where
possible.)

Regards,
  Tony




More information about the rabbitmq-discuss mailing list