# Creating & Managing Spark Queues

This article explains creating and managing queues for use with Spark Messaging. You can learn more about <a class="external-link " href="https://developer.veevavault.com/sdk/#Vault_Integrations" target="_blank" rel="noopener">Spark Messaging in the Developer Portal<i class="fa fa-external-link" aria-hidden="true"></i></a>.

## Accessing Spark Queue Administration

View and manage queues from **Admin > Connections > Spark Queues**. You must have a security profile that grants the _Admin: Queues_ permissions to work with queues.

## How to Create Spark Queues

To create a new queue:

  1. From the **Spark Queues** page, click **Create**.
  2. Enter a **Label** for this queue. This is the label which appears for Admins in the Vault UI.
  3. Vault automatically populates the **Name** field. This is the name for the queue when called from Vault Java SDK code. Only lowercase, alphanumeric characters and a single underscore (\_) between characters are allowed.
  4. Select a **Status** for this queue. Only _Active_ queues can accept messages.
  5. Optional: Enter a **Description** for this queue.
  6. Select a **Queue Type**. If you want this queue to send messages, select _Outbound_. If you want this queue to receive messages, select _Inbound_.
  7. If your **Queue Type** is _Inbound_, select a **Spark Message Processor**. These are custom Vault extensions created with the Vault Java SDK designed to process messages. You can view details about the Spark message processors available in your Vault in **Admin > Connections > Spark Message Processors**.
  8. If your **Queue Type** is _Inbound_, select a **Spark Message Processor User**. This is the user who will process messages delivered to this queue.
  9. Optional: If your **Queue Type** is _Outbound_, select a **Spark Message Delivery Event Handler** and **Spark Message Delivery Handler User**. Learn about <a class="external-link " href="https://developer.veevavault.com/sdk/#Message_Delivery_Event_Handler" target="_blank" rel="noopener">Spark Message Delivery Event Handlers in the Developer Portal<i class="fa fa-external-link" aria-hidden="true"></i></a>.
 10. Optional: If the messages intended for this queue must be processed sequentially, meaning one after another in the order they are received, select **Sequential Message Processing**. This is generally not recommended as it will cause messages to accumulate in the queue and slow down delivery.
 11. Optional: If you want this queue to continue the transaction when a message fails to enter the queue, deselect **Rollback on Error**. Otherwise, failure to put a message into this queue will rollback the entire transaction.
 12. Click **Save**.

After creating a queue, you may want to add a **Queue Connection**. Learn more about <a href="/en/gr/53358/">creating connections.</a>

## Managing Queue Connections

If your queue is attached to a connection, it will appear under the _Queue Connections_ section on the queue's _Details_ page. This section shows you various details related to your queue connections, such as _Connection Type_, _URL_, and _Connection Name_.

From the _Details_ page, you can **Create** more queue connections or **View**, **Edit**, and **Delete** existing connections on this queue from the **Actions** menu.

## How to Inactivate a Spark Queue

If you want a Spark queue to stop receiving messages, you must set the queue _Status_ to _Inactive_. Once inactive, a queue cannot accept any new messages.

This does not prevent a queue from processing messages which are already in the queue. For example, if an outbound queue had messages in it prior to inactivating the queue, those messages are still sent. If you want to stop sending messages already in the queue, you must [disable delivery][6].

To inactivate a queue:

  1. In the queue _Details_ page, click **Edit**.
  2. Set the **Status** to _Inactive_.
  3. Click **Save**.

An inactive queue will immediately stop accepting messages. If you want to re-activate this queue, you can do so with the same process. Once a queue is _Active_, it will start accepting messages again.

## How to Disable Delivery {#Disable_Delivery}

If you want an outbound Spark queue to stop delivering existing messages, you must disable the queue. This prevents any messages from exiting the queue, but does not prevent new messages from entering the queue. For example, an _Active_ queue with a _Delivery Status_ set to _Disabled_ will still allow new messages to enter the queue, but no messages will exit the queue.

To disable a queue:

  1. Navigate to the outbound queue where you wish to disable delivery.
  2. From the **Actions** menu, select **Disable Delivery**.
  3. The queue is now disabled. In the queue details, the Delivery Status now shows as **Disabled**.

If you want this queue to begin delivering messages again, you can enable the queue with the same process.

This option is not available for inbound queues, as inbound queues process received messages rather than deliver messages. There is no way to stop an inbound queue from processing existing messages. If you have an inbound queue with existing messages you do not want processed, you must [reset the queue][7].

## How to Delete All Messages in a Spark Queue {#ResetQueue}

Changing the _Status_ or _Delivery Status_ of a queue does not delete any messages in the queue. For example, an _Inactive_ queue with a _Delivery Status_ set to _Disabled_ cannot send or receive messages, but any messages in the queue remain. If you no longer want these messages, you can reset the queue.

This action is permanent and cannot be undone.

To reset a queue:

  1. Navigate to the queue where you wish to reset.
  2. Click **Reset Queue**.
  3. After reading the warning, click **Continue**.
  4. When the process is complete, you will receive a green banner notification that Vault successfully reset the queue.

  [6]: #Disable_Delivery
  [7]: #ResetQueue
