Page MenuHomeDevCentral

Clean up queue if exchange doesn't exist
ClosedPublic

Authored by dereckson on Jul 6 2017, 20:00.
Tags
None
Referenced Files
F3756693: D999.id2554.diff
Tue, Nov 19, 02:34
F3756684: D999.id2553.diff
Tue, Nov 19, 02:23
F3756682: D999.id2552.diff
Tue, Nov 19, 02:20
F3756464: D999.diff
Tue, Nov 19, 00:41
Unknown Object (File)
Mon, Nov 18, 00:00
Unknown Object (File)
Sun, Nov 17, 19:24
Unknown Object (File)
Sat, Nov 16, 05:12
Unknown Object (File)
Sat, Nov 16, 02:38
Subscribers
None

Details

Summary

When the API client calls /delivery/register_consumer, a queue is
first created, then bound to an exchange.

If the exchange doesn't exist, the queue has been created but is
unused. If we check the exchange exists through a passive exchange
declaration, we always introduce an extra call to the broker.

It's so probably faster to delete queue afterwards when this occurs.

Test Plan

Post the following payload to /delivery/register_consumer:

{
	"exchange": "notexisting"
}

Get the following output to the console:

Deleting unused queue: delivery-020ea9cd-08c8-4029-83e2-28e21039c3cb
127.0.0.1 - - [06/Jul/2017 22:00:03] "POST /delivery/register_consumer HTTP/1.1" 400 -
Channel error: (404, "NOT_FOUND - no exchange 'notexisting' in vhost 'test'")

Queue wasn't present in the broker administration panel.

Diff Detail

Repository
rND Delivery API for Notifications center
Lint
Lint Passed
Unit
No Test Coverage
Branch
avoid_queues_flood_on_non_existing_exchange
Build Status
Buildable 1559
Build 1807: arc lint + arc unit

Event Timeline

dereckson created this revision.
dereckson edited edge metadata.

Pruned debug statements not for this change

This revision is now accepted and ready to land.Jul 6 2017, 20:03
This revision was automatically updated to reflect the committed changes.