Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic Code: Visual C++

C#
Visual Basic
Visual C++

Berkeley DB .NET API Documentation
QueueDatabase..::.Consume Method (Boolean, Transaction)
QueueDatabase Class See Also

Return the record number and data from the available record closest to the head of the queue, and delete the record.

Namespace: BerkeleyDB
Assembly: libdb_dotnet48 (in libdb_dotnet48.dll) Version: 4.8.24.0

# Syntax

C#
    public KeyValuePair<uint, DatabaseEntry> Consume(
    	bool wait,
    	Transaction txn
    )

Visual Basic (Declaration)
    Public Function Consume ( _
    	wait As Boolean, _
    	txn As Transaction _
    ) As KeyValuePair(Of UInteger, DatabaseEntry)

Visual C++
    public:
    KeyValuePair<unsigned int, DatabaseEntry^> Consume(
    	bool wait,
    	Transaction^ txn
    )

#### Parameters

wait
  Type: System..::.Boolean
  If true and the Queue database is empty, the thread of control will wait until there is data in the queue before returning.

txn
  Type: BerkeleyDB..::.Transaction
  txn is a Transaction object returned from BeginTransaction()()(); if the operation is part of a Berkeley DB Concurrent Data Store group, txn is a handle returned from BeginCDSGroup()()(); otherwise null.

#### Return Value

A KeyValuePair<(Of <(TKey, TValue>)>) whose Key parameter is the record number and whose Value parameter is the retrieved data.

# Exceptions

Exception | Condition
--- | ---
BerkeleyDB..::.LockNotGrantedException | If lock or transaction timeouts have been specified, a LockNotGrantedException may be thrown. This failure, by itself, does not require the enclosing transaction be aborted.

# See Also

QueueDatabase Class
Consume Overload
BerkeleyDB Namespace