Skip to content

[3.5 M3] Clearable Queues

Mariano Gonzalez edited this page Sep 9, 2013 · 1 revision

Motivation / Context

There're use cases for components that make intensive use of Queues. We need a way to cleanly and quickly discard all the items in that queue so that its allocated resources can be reclaimed.

#Use cases

As a Mule component, I want to discard all items in a Queue I won't be polling from anymore

Design

Add a clear() method to the QueueManager interface.

  • Items should be cleared in the fastest way possible.
  • If the manager implementation is thread safe, then this method should be also. If the implementation is not thread safe, then no assumptions should be done on this method
  • the queue should still be usable after performing a clear. This is not a close() nor a dispose()

Behavior

  • In case of persistent object store, the actual files backing the content will be deleted
  • In case of transient object stores, the reference to the items will be severed.
  • ObjectStoreManager's dispose() method should first delegate into the store's clear method and then dispose() it if necessary.

Migration Impact

  • All the QueueManager implementations that ship with Mule will be updated by our dev team, but any extension using a custom implementation of OS will need to addd support for this feature.
  • CloudHub will have to add support for this feature.

Documentation impact

There's no public documentation about the QueueManager other than javadocs