Using the Queue Field in the Event Registry | User-Defined QueuesOverview
The Queue field was added to the Event Registry in Berlin to allow users to direct their events to a user-defined queue. User-defined queues separate event processing of your events from baseline queues. Creating your own queue prevents processing delays when baseline queues are busy. For example, if you send your event to the text_index queue, your Priority1Event could theoretically be delayed half an hour while ServiceNow processes 100,000 non-critical text index events created by a data import.
Use this feature only when there is a possibility of long Script Action Processing times or rapid generation of events causing high volumes in the queues.Procedure
Creating a Queue
- Navigate to the Event Registry, System Policy > Events > Registry.
- Create a new event.
- When configuring the new Event, enter a value in the Queue field. By convention, queue names are all lowercase and use underscores instead of spaces.
- Save the event.
Processing the Queue
You must create a Scheduled Job to monitor the user-defined queue for new event entries to be processed.
- Navigate to System Scheduler > Scheduled Jobs > Scheduled Jobs.
- Open the text index events process Scheduled Item and make the following modifications:
- Change the name.
- In the Job context field locate the GlideEventManager method call and replace the string text_index with the name of your new queue.
- Decide if legacy or delegated events processor should be used.
- For the legacy processing, no additional changes are needed to the job.
- If the events in this queue can be processed delegated, change the GlideEventManager method from process() to processDelegatedEvents(). Change also the system_id to "Active nodes". Validate that the new events processors jobs are created and their records are present in the [sys_event_processor] table.
Example of job context for delegated events processing:
- Right-click on the Schedule Item header and select Insert and Stay.
Important: Do NOT overwrite the baseline text index events process Scheduled Job.
Generating the Event
Generate the event with the gs.eventQueue() method as usual. No special consideration or parameters are required for sending an event to a specific queue as this is determined by the Registry.Determining which Queue an Event is In
- Navigate to System Policy > Events > Event Log.
- Locate your Event and scroll to the Queue column.
If there is a value in the Queue field, the event went to a Queue other than the default queue. If the Queue field is blank, the event was sent to the default queue.