---
title: "Engage.processEventQueue()"
slug: "engage-processeventqueue"
abstract: "Describes the processEventQueue() function in the Sitecore Engage SDK (Sitecore CDP Stream API)."
---
# Engage.processEventQueue()

The `processEventQueue()` function:

- Runs the event queue, sending all the events that are in it.
- Sends the events in the order they were added to the event queue.
- Waits for a response from each event before it sends the next event.
- Empties the event queue.

sidebar. Parameters

none

Here's an example of how to use the `processEventQueue` function to run the event queue.

In this scenario, we add different events to the event queue depending on whether a site visitor clicked a dropdown menu and a dropdown menu item.

When you run the event queue, either the `DROPDOWN_CLICK` then the `DROPDOWN_ITEM_CLICK` events are sent, or the `DROPDOWN_CLICK` then the `DROPDOWN_ABANDON` events.

```javascript
if (clickedDropdown) {
  engage.addToEventQueue("DROPDOWN_CLICK", eventData);

  if (clickedDropdownItem) {
    engage.addToEventQueue("DROPDOWN_ITEM_CLICK", eventData);
  } else {
    engage.addToEventQueue("DROPDOWN_ABANDON", eventData);
  };

  engage.processEventQueue();
};

```