Skip to content

PostGreQueueCreationOptions

blehnen edited this page Nov 10, 2026 · 5 revisions

Postgre Queue Creation Options

When you create a new queue, you can enable and disable various features. Most of these options change the schema of the queue. You must set all of these options before you create the queue.

  • Additional columns

You can add additional columns to the queue status table. When you send a message, you can then include data for these columns. The queue stores user columns on the status table.

Add a user-defined column named 'OrderID':

createQueue.Options.AdditionalColumns.Add(new Column("OrderID", ColumnTypes.Bigint, true));

Send user-defined data with a message. The dequeued message does not include this data.

var data = new AdditionalMessageData();
data.AdditionalMetaData.Add(new AdditionalMetaData<Int64>("OrderID", 1234));
queue.Send(message, data);
  • Additional constraints

Add an index on the OrderID column. Every column and index that you add degrades performance.

createQueue.Options.AdditionalConstraints.Add(new Constraint("OrderID_IX", ContraintType.Index, "OrderID"));
  • EnableDelayedProcessing

You can configure the queue to support delayed processing. If a queue does not need delayed processing, you can set this to false to increase performance. The retry behavior uses this option. If you disable it and enable retries, the queue does not delay the retries.

If this setting is false and you pass a delay with a message, the queue ignores the delay.

createQueue.Options.EnableDelayedProcessing = true;
  • Holding a transaction until the message is committed

You can tell the queue to keep the dequeue transaction open until the message finishes processing. This strains your server. Enable it only if you really need it.

createQueue.Options.EnableHoldTransactionUntilMessageCommitted = true;
  • Enable Heartbeat

You can configure the queue to support heartbeats. If a worker dies, other workers can dequeue the message. You cannot enable this option if the queue holds transactions.

createQueue.Options.EnableHeartBeat = true;
  • Enable Message Expiration

You can configure the queue to support message expiration. If a queue does not need expiration, you can set this to false to increase performance. RPC queues set this to true when they are created, even if you set it to false.

If this setting is false and you pass an expiration with a message, the queue ignores the expiration.

createQueue.Options.EnableMessageExpiration = true;
  • Enable Priority

You can configure the queue to support message priority. Priority lets you move messages to the front of the queue. Without priority, the queue behaves as a loose FIFO queue.

If this setting is false and you pass a priority with a message, the queue ignores the priority.

createQueue.Options.EnablePriority = true;
  • Enable Route

Tag messages with a route string. Consumers can filter to process only messages with a specific route.

createQueue.Options.EnableRoute = true;
  • Enable Status

You can enable a status column on the queue. If heartbeat is enabled, this option is required. The status column lets the queue roll back messages and recover from crashed workers.

If both transactions and status are disabled, the queue acts as a FIFO queue and cannot recover messages. This might be what you want if speed is important and you can accept the loss of some messages when a worker crashes, the power fails, or something similar happens.

createQueue.Options.EnableStatus = true;
  • Enable Status Table

The queue can create and update a separate table that you can query to see the status of the queue. This is safer than querying the queue itself, because a direct query can block operations and cause deadlocks.

If you add user columns to the queue, the queue enables this table automatically and stores the user columns in it.

createQueue.Options.EnableStatusTable = true;
  • Enable History

You can configure the queue to record a history of processed messages. The default is false.

createQueue.Options.EnableHistory = false;
  • Queue Type

There are three types of queues:

Normal

RPCSend

RPCReceive

For RPC, you need to create two queues: an RpcSend queue and an RpcReceive queue. When you run the RPC queue, you pass it both queues so that it knows where to write requests and where to listen for responses.

See PostGreOptions for the complete property reference and validation rules.

See MessageHistory for history retention configuration.

See UserDequeueColumns for using additional columns in dequeue queries.

Clone this wiki locally