_______________________________________________
rabbitmq-discuss mailing list
rabbitmq...@lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
What do instances of classes represent? Looks like they'd have to
contain a mixture of attributes with completely different purposes. In
particular there is a conflation of attributes for AMQP entities and
AMQP commands.
For example, 'passive' is not an attribute of an AMQP queue; it's a flag
on the queue.declare command. And 'message_count' is only something you
get as a return of queue.declare, so accessing that attribute in any
other context is meaningless.
Matthias.
What do instances of classes represent? Looks like they'd have to contain a mixture of attributes with completely different purposes.
In particular there is a conflation of attributes for AMQP entities and AMQP commands.
For example, 'passive' is not an attribute of an AMQP queue; it's a flag on the queue.declare command.
And 'message_count' is only something you get as a return of queue.declare, so accessing that attribute in any other context is meaningless.
Gavin M. Roy wrote:
> The major change for the driver, from my perspective, is the removal of
> auto-generated driver mixin rpc command methods to having a object model
> closer to what is seen in spec.py, with the AMQP methods accessed
> through their class directly. Think Basic.ack(channel, delivery_tag)
> instead of channel.basic_ack(delivery_tag).
It's a common misconception about AMQP that the spec's class/method
terminology implies some sort of sensible mapping to the corresponding
OO terms. It does not.
What state is associated with instances of the Basic class?
Or with instances of the Queue class?
When I have an instance of Queue in your proposed API, what does it
represent?
1) All queues of any name, in any vhost, in any broker
2) All queues of any name, in any vhost, in a particular broker
3) All queues of any name, in a particular vhost & broker
4) A queue of a specific name, in any vhost, in any broker
5) A queue of a specific name, in any vhost, in a particular broker
6) A queue of a specific name, in a particular vhost & broker
?
To me only (1) makes sense, which leaves instances stateless, so all you
are really doing is grouping a whole bunch of "static" methods under
different headings ("queue", "exchange", etc).
(6) would make some sense too. The Queue constructor would take the
channel and queue name.
Regards,
> Gavin,
>
> Gavin M. Roy wrote:
>> The major change for the driver, from my perspective, is the
>> removal of auto-generated driver mixin rpc command methods to
>> having a object model closer to what is seen in spec.py, with the
>> AMQP methods accessed through their class directly. Think
>> Basic.ack(channel, delivery_tag) instead of channel.basic_ack
>> (delivery_tag).
>
> It's a common misconception about AMQP that the spec's class/method
> terminology implies some sort of sensible mapping to the
> corresponding OO terms. It does not.
>
> What state is associated with instances of the Basic class?
>
> Or with instances of the Queue class?
>
> When I have an instance of Queue in your proposed API, what does it
> represent?
>
> 1) All queues of any name, in any vhost, in any broker
> 2) All queues of any name, in any vhost, in a particular broker
> 3) All queues of any name, in a particular vhost & broker
> 4) A queue of a specific name, in any vhost, in any broker
> 5) A queue of a specific name, in any vhost, in a particular broker
> 6) A queue of a specific name, in a particular vhost & broker?
> ?
any one of those.
it depends on which of its attributes have been constrained by
assigned values.
(1) is the class' interface (as you note below). most likely an
instance would correspond to (3) or (6), but the particulars would
depend on the application's control patterns.
>
> To me only (1) makes sense, which leaves instances stateless, so
> all you are really doing is grouping a whole bunch of "static"
> methods under different headings ("queue", "exchange", etc).
>
> (6) would make some sense too. The Queue constructor would take the
> channel and queue name.
_______________________________________________
It never has been. That's why Twisted is still perceived as a separate
library (as opposed to, for example EventMachine for ruby, which
often is treated as a core part of the ruby framework).
> The roadmap for changes to Pika 2.0:
[...]
> - Remove existing connection adapter system
> - Implement new pattern for use, behavior based use focused on
> both Asynchronous callback passing style and "Pythonic" development.
> - Both behaviors available from the same API calling same classes and
> methods
> - Async:
> - Merge existing connections into one connection system with IOLoop
> override
> - Supporting internal IOLoop, tornado, twisted
> - Pythonic:
> - high-level blocking on synchronous AMQP commands
> - Generator for receiving messages from Basic.Publish
That's a quite interesting approach. But non-trivial python
generators are hard to compose. Beware.
> - API notation closer to AMQP spec for implementation.
Sounds good.
> - *.*Ok frames will only be passed back in CPS use.
That means using 'no-wait' whenever possible.
But what if the thing will crash a channel
(trigger an amqp channel-error). How would you notify
a user that the channel can't be used any more?
For example: queue.unbind() with bad parameters may
trigger a channel-wide NotFound error.
[...]
> I am looking for feedback on this direction. Do these changes and the
> example make sense to existing Pika and RabbitMQ uses? Would you change
> anything about this direction? What would you improve?
You may find this inspiring:
https://github.com/ask/kombu/blob/master/examples/complete_receive.py#L39
https://github.com/majek/puka/blob/master/examples/stress_amqp.py#L60-62
Cheers,
Marek
On Sunday, March 13, 2011 at 1:20 PM, Matthias Radestock wrote:
Gavin,
Gavin M. Roy wrote:The major change for the driver, from my perspective, is the removal of
auto-generated driver mixin rpc command methods to having a object model
closer to what is seen in spec.py, with the AMQP methods accessed
through their class directly. Think Basic.ack(channel, delivery_tag)
instead of channel.basic_ack(delivery_tag).
It's a common misconception about AMQP that the spec's class/method
terminology implies some sort of sensible mapping to the corresponding
OO terms. It does not.
What state is associated with instances of the Basic class?
Or with instances of the Queue class?
6) A queue of a specific name, in a particular vhost & broker
(6) would make some sense too. The Queue constructor would take the
channel and queue name.
More specifically a queue of a specific name on a specific channel.