You can use custom queues for applications that create a large volume of events or events that take a long time to process. This task shows how to create a custom queue, its monitoring process, and use a script to send events to the queue.

Before you begin

Role required: admin

Note: This information is for advanced users who understand event processing.

Procedure

  1. Navigate to System Policy > Events > Registry.
  2. Select the event for which you want to create a custom queue.
    The Event Registration form displays.
  3. Populate the Queue field for the event in the Event Registry.
    Use only lowercase letters, no spaces, and no special characters except underscore (_).

    Event Registration form highlighting Queue field containing the name of the queue in lower case.

  4. Click Submit.
    A new event is listed in the Events [sysevent] table.

    In the following example, when the employeeOccasion event is generated, the event is added to my_queue. The events are stuck in the queue. To resolve this issue, create a process to watch the queue for events.Events table listing the event with the added queue listed in the queue field.

  5. Navigate to System Scheduler > Scheduled Jobs > Scheduled Jobs and open the scheduled job named text index events process.
    Schedule table with *text in the Name search field and the name of the text index events process schedule highlighted.
  6. Click the additional actions menu icon (additional actions icon menu) and select Insert and Stay to create a copy of text index events process.
    Important: Be sure to copy the job and not overwrite the text index events process Scheduled Job.
  7. In the copied schedule item, change the value in the Name field.
  8. In the Job context field, replace the value for the GlideEventManager() parameter with the name of the new queue.
    Schedule Item form showing the copied item renamed and the updated queue name for GlideEventManager in theJob context field.
    The queue monitoring process looks for and processes events in the example my_queue event queue.

    Events table highlighting the contents of the Processed and Queue fields.

  9. Use the gs.eventQueue() method's fifth parameter to send events to the custom queue.

    The following code shows how to send an event to the my_queue custom queue.

    gs.eventQueue('x_60157_employee_spe.employeeOccasion', todaysOccasions, todaysOccasions.number, todaysOccasions.u_employee.name, 'my_queue');
    Note: If an event is in the Event Registry and no queue name is provided to gs.eventQueue, the queue from the Event Registry is still assigned to the event. For example, gs.eventQueue('x_60157_employee_spe.employeeOccasion') still associates the event with my_queue. If the queue name is provided in the gs.eventQueue() call, the queue takes priority.
    You can verify that the event called was processed by checking the Events [sysevent] table.

    Events table listing processed events filtered by the event name.