Page MenuHomeDevCentral

Clean up queue if exchange doesn't exist
ClosedPublic

Authored by dereckson on Jul 6 2017, 20:00.
Tags
None
Referenced Files
F3753215: D999.diff
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
Unknown Object (File)
Sat, Nov 16, 00:21
Unknown Object (File)
Fri, Nov 15, 11:13
Unknown Object (File)
Thu, Nov 14, 17:38
Unknown Object (File)
Thu, Nov 14, 05:19
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 Not Applicable
Unit
Tests Not Applicable

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.