Add a method to clear all messages from a channel
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 61
- Forks
- 31
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 9
Description
Proposed new feature or change
There's no programmatic way to empty a queue. It comes up in three places:
- Maintenance - a
queue:purgecommand or an admin button to drop a queue that got flooded with poison pills or jobs that are no longer wanted. - Deployments - clearing a queue during a release when the payload structure changed and old queued jobs would crash on the new code.
- Testing - resetting state between runs. Shelling out to
redis-cliorrabbitmqctlmakes the test suite fragile and awkward to run in containerized CI.
I wouldn't put this on AdapterInterface - that would break every existing implementation and it overlaps with the "not the job of the primary interface" point from #271. A separate opt-in interface fits better:
interface PurgeableInterface
{
public function purge(): void;
}
Adapters implement it when the backend can do it cheaply (Redis drops the channel keys, AMQP calls queue_purge, the in-memory adapter resets its array). Callers check for it:
if ($adapter instanceof PurgeableInterface) {
$adapter->purge();
}
Open questions:
- Name:
purge()(broker vocabulary) orclear()? - Signature:
purge(): voidon the adapter's current channel (consistent withpush/status, which don't take a channel) orpurge(string $channel)?
Worth pursuing? Happy to send a PR if you're good with it (core + redis/amqp).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading AdapterInterface and the existing push/status entry points, then inspect the Redis, AMQP, and in-memory adapters. Resolve the purge-versus-clear name and channel-signature questions; done means the opt-in interface and the proposed adapter implementations support emptying a channel without changing the primary interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, rabbitmq, redis
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100