Purging events from the data store

Events can be purged from the data store by specifying groups, selectors, or both.

An event consumer or an administrative tool can purge events from the data store using the event access interface. You can purge all of the events from the data store, or you can limit the purge to event groups, event selectors, or both.

To purge events from the data store, use the purgeEvents method of the event access bean.
int purged = eventAccess.purgeEvents(eventGroup,
                                     eventSelector,
                                     transactionSize);
The parameters are as follows:
eventGroup
A string that contains the name of the event group that includes the events you want to purge. This name must be the name of an existing event group that is defined in the event infrastructure configuration. If you do not want to specify an event group, this parameter can be null.
eventSelector
A string that contains an optional event selector that identifies the events to purge. An event selector is specified in the form of an XPath expression. If you do not want to specify an event selector, this parameter can be null.
transactionSize
A nonzero integer that specifies the number of events that you want to purge in a single database transaction. In most cases, you can use the DEFAULT_PURGE_TRANSACTION_SIZE constant, which is defined by the EventAccess interface.

The purgeEvents method purges all of the events that match all of the criteria that you specify. If the eventGroup and eventSelector parameters are both null, all of the events in the data store are purged. Events that arrive after the purge operation starts are not purged. The returned value is an integer that specifies how many events were purged.

If the value of the transactionSize parameter exceeds the maximum purge transaction size defined in the data store profile, a PurgeThresholdExceededException exception is thrown and no events are purged. The default maximum purge transaction size is 100 000.

Parent topic: Querying events from the event server

Related concepts
Writing event selectors