[rabbitmq-discuss] questions about RpcClient
Steve Powell
steve at rabbitmq.com
Wed Nov 23 12:09:59 GMT 2011
Dear John,
On 22 Nov 2011, at 16:22, john doe wrote:
> I find strange that primitiveCall do not follow the signature of original
> functions, with exchange and routing key provided along with the message.
Well, there are a lot of strange things about this code; and it is not very
good Java, to be honest (it calls protected methods in its constructor for one
thing). I guess I'd like to re-write it. The protected methods seem to encourage
you to sub-class it, for instance. In general I'm not keen on subclassing
as a user API, unless it is very carefully controlled (as in Consumer),
and in this case it would be easy to break things.
> I am using extensively routing facilities of amqp, and I need to manage
> thousands of clients, one per routing key (or do you think creating a channel
> and a private queue is cheap enough to be done tens of time per second?)
The overhead of an RpcClient creation is non-trivial; but the creation of the
private (reply)queue is essential, so that we can't get away from that. Tens of
times a second ought to be easy, though. Creating a channel each time would
be a serious problem -- don't do that. Multiple consumers on the same channel
are OK (there's even a way to beef up the callback threads in 2.7.0)
and ought to perform well.
Having thousands of RPCs on a single channel at once might be pushing
it, though.
> I guess you designed this RpcClient class more as an example, to be customized?
> That's fine but code of RpcClient is not that simple and I would have prefered
> not to maintain that kind of risky low-level things...
Yes, I agree. It certainly is just an example. A simpler and cleaner one suited to
your needs should be derived from it.
> Would you consider putting a primitiveCall(String exchange, String routingKey,
> AMQP.BasicProperties props, byte[] message) in a future release?
Yes; but I would like to clean up RpcClient before that. I'd be delighted with
any comments from the field.
Steve Powell (a happy bunny)
----------some more definitions from the SPD----------
avoirdupois (phr.) 'Would you like peas with that?'
distribute (v.) To denigrate an award ceremony.
definite (phr.) 'It's hard of hearing, I think.'
modest (n.) The most mod.
More information about the rabbitmq-discuss
mailing list