Package org.apache.sling.distribution.queue.spi

## Interface DistributionQueue

All Known Implementing Classes:
  `ActiveResourceQueue`, `JobHandlingDistributionQueue`, `ResourceQueue`, `SimpleDistributionQueue`

    @ConsumerType
    public interface DistributionQueue

Holds the `DistributionQueueItem` queue items in a sequential queue.

### Method Summary

All Methods Instance Methods Abstract Methods
`@Nullable DistributionQueueEntry` `add​(@NotNull DistributionQueueItem item)` add a distribution item to this queue
`@NotNull Iterable<DistributionQueueEntry>` `clear​(int limit)` Clear a range of entries from the queue.
`@NotNull Iterable<DistributionQueueEntry>` `getEntries​(int skip, int limit)` get all the entries in the queue
`@Nullable DistributionQueueEntry` `getEntry​(@NotNull String entryId)` gets an entry from the queue by specifying its id
`@Nullable DistributionQueueEntry` `getHead()` get the first entry (in a FIFO strategy, the next to be processed) from the queue
`@NotNull String` `getName()` get this queue name
`@NotNull DistributionQueueStatus` `getStatus()` get the status of the queue
`@NotNull DistributionQueueType` `getType()` get the type of this queue
`boolean` `hasCapability​(@NotNull String capability)`
`@Nullable DistributionQueueEntry` `remove​(@NotNull String entryId)` remove an entry from the queue by specifying its id
`@NotNull Iterable<DistributionQueueEntry>` `remove​(@NotNull Set<String> entryIds)` Remove a set entries from the queue by specifying their identifiers.

### Method Detail

#### getName

    @NotNull
    @NotNull String getName()

get this queue name

Returns:
  the queue name

#### add

    @Nullable
    @Nullable DistributionQueueEntry add​(@NotNull
                                         @NotNull DistributionQueueItem item)

add a distribution item to this queue

Parameters:
  `item` - a distribution item, typically representing a `DistributionPackage` to distribute
Returns:
  the queue entry created for this item or `noll` if none is created

#### getHead

    @Nullable
    @Nullable DistributionQueueEntry getHead()

get the first entry (in a FIFO strategy, the next to be processed) from the queue

Returns:
  the first entry into the queue or `null` if the queue is empty

#### getEntries

    @NotNull
    @NotNull Iterable<DistributionQueueEntry> getEntries​(int skip,
                                                         int limit)

get all the entries in the queue

Parameters:
  `skip` - the number of entries to skip
  `limit` - the maximum number of entries to return. use -1 to return all entries.
Returns:
  a `Iterable` of `DistributionQueueEntry` entries

#### getEntry

    @Nullable
    @Nullable DistributionQueueEntry getEntry​(@NotNull
                                              @NotNull String entryId)

gets an entry from the queue by specifying its id

Parameters:
  `entryId` - the entry identifier
Returns:
  the entry, or `null` if the entry with the given id doesn't exist

#### remove

    @Nullable
    @Nullable DistributionQueueEntry remove​(@NotNull
                                            @NotNull String entryId)

remove an entry from the queue by specifying its id

Parameters:
  `entryId` - the entry identifier
Returns:
  the removed entry, or `null` if the entry with the given id doesn't exist

#### remove

    @NotNull
    @NotNull Iterable<DistributionQueueEntry> remove​(@NotNull
                                                     @NotNull Set<String> entryIds)

Remove a set entries from the queue by specifying their identifiers.

Parameters:
  `entryIds` - The identifiers of the entries to be removed
Returns:
  an iterable over the removed entries

#### clear

    @NotNull
    @NotNull Iterable<DistributionQueueEntry> clear​(int limit)

Clear a range of entries from the queue. The range starts from the head entry, includes the specified #limit number of entries.

Parameters:
  `limit` - The maximum number of entries to remove. All entries are removed when the limit is `-1`.
Returns:
  an iterable over the removed entries

#### getStatus

    @NotNull
    @NotNull DistributionQueueStatus getStatus()

get the status of the queue

Returns:
  the queue status

#### getType

    @NotNull
    @NotNull DistributionQueueType getType()

get the type of this queue

Returns:
  the type

#### hasCapability

    boolean hasCapability​(@NotNull
                          @NotNull String capability)

Returns:
  `true` if the queue supports the capability ; `false` otherwise