Drupal 7 has added a number of new features that services could utilise one of the key ones in my eyes queues. Before I start building out this service I want to try and get some agreement on scope. As I see it there are 3 use cases
* Pushing items onto a queue for drupal cron to process using existing drupal queues
* Pushing items onto a queue for a new queue to process - in a sense this is the same as the above as drupal is still processing the queue
* Pushing items onto a queue that drupal core does not process and instead another service or drush command process out of sync with core
As I see we need the following services
* queue.put - this will validate that the queue is defined in a hook_cron_info callback
* queue.get - this will pull items from a given queue
Currently I see this the queue_service module as providing a UI that provides a list of defined queue backs, and allows an admin to say this is processed by cron or not, if flagged as not they will be unset in hook_cron_queue_alter. Obviously access right to a give queue need to be thought.
Comments more than welcome....
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | queue-service.patch | 6.12 KB | marcingy |
Comments
Comment #1
gddI think this is a cool idea but I'm reluctant to go down the slippery slope of feature adding when we're in RC (of course I'm looking to commit an API change in another issue so what do I know.) We could add this in a point release and I'd have no problems.
Comment #2
voxpelli commentedAs we no longer have "services" in 3.x this would need to be a resource and following the new CRUD-API the queue.put would instead be named queue.create I think?
To be able to add things to a queue seems reasonable and useful - we should do that.
I'm more skeptical to being able to fetch and process stuff from the top of the queue as the queue system itself is extendable and the system in core isn't meant for external processing. An extension of the queue system that exposes the queue data externally seems to me like a better approach?
Comment #3
marcingy commentedHaving had a bit more of think about this, what sits in services should be minimal, and should only deal with simple activies. There is nothing stopping a module doing a claim item on queue so the ability to pop elements off the queue via services I believe makes sense. So this new feature would only do 2 things it would allow for items to be place on the queue, and would allow for items to be claimed from the queue. Any additional features would sit in seperate non-core services module.
With regards when this goes into services, I agree it makes sense to get 7.0-3.x out of the way before introducing this feature.
Comment #4
marcingy commentedComment #5
marcingy commentedFirst stab at a queue service
Comment #6
marcingy commentedComment #7
voxpelli commentedI don't think you should use retrieve for claiming an item - an action would be better for two reasons: One is that you can't target a specific item in the queue - which is to be expected for retrieve I think. The other is that claiming is an action that alters the state of the server and thus shouldn't be something that is exposed through GET-requests.
Comment #8
marcingy commentedSorry for the delay in replying I have had a weeks vacation. I'm thinking that maybe the best approach for this is as follows split the issue into 2, one which deals with the putting items on the queue, which I think has few issues for this initial version of the service and then following up once that hits with a queue get resource as that seems to have more complexity.
I agree that a get might not be the best way to retrieve items from the queue and that some other form of retrievel needs to be utilised. I need to look at an example and work out how to create an action (my 3.x services knowledge is just starting to develop) and it maybe the case that once I do that I'll decide not to split the patch into 2.
Thanks for reviews so far they are really useful and are providing me a better understand of the new architecture.
Comment #9
gddTrying to clear out the 7.3 issue queue, will move these to 7.4 when it opens
Comment #10
marcingy commentedIf this happens it will be contrib