graze / queue

:postbox: Flexible abstraction for working with queues in PHP.
MIT License
49 stars 10 forks source link

Manage queue types across environments #33

Open stevenscg opened 8 years ago

stevenscg commented 8 years ago

This is just a general question regarding the project's view of how queue types should be managed across (or between) various deployment environments.

I've noticed that some queue abstraction libraries allow producers and consumers to operate against a "well-known" queue by name (or similar) independent of the underlying adapter.

For example, this allows producers and consumers to operate against a simple database table "queue" in a developer or CI environment while using SQS in the fully-deployed scenario.

I'm not sure that is possible or even a good idea, but it is a pattern that seems to exist.

Thoughts? Recommendations?

sjparkinson commented 8 years ago

@h-bragg got any input here?

I personally think it'd add unnecessary complexity to the library, and enable something that a decent framework would handle anyway with environment based configuration and a service container.

h-bragg commented 8 years ago

I agree that it would add complexity to the library. But could be something to consider in the future; I see https://github.com/eventio/bbq main interface is a layer above the queue, so you can access and push to multiple queues with a single class.

The first thing I can think of, with limiting any environment checks in code, would be to have an QueueAdapterFactory that supports queue name resolution like: s3:queue_name. This should probably sit in your code base as it would require the s3 client/others, etc.