An event consumer or administrative tool can delete events from
the data store using the event access interface.
Why and when to perform this task
You can delete all events from the data store, or you can limit
the deleted events by specifying event groups, event selectors, or both.
Note: If
WebSphere security is enabled, the application user ID must be mapped to the
eventAdministrator role to delete events.
Steps for this task
To delete 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 containing the name of the event group that includes the events
you want to delete. This must be the name of an existing event group defined
in the event infrastructure configuration. If you do not want to specify an
event group, this parameter can be null.
- eventSelector
- A string containing an optional event selector that identifies the events
to delete. An event selector is specified in the form of an XPath expression
(for more information, see Writing event selectors).
If you do not want to specify an event selector, this parameter can be null.
- transactionSize
- A nonzero integer specifying the number of events you want deleted in
a single database transaction. In most cases, you can use the constant DEFAULT_PURGE_TRANSACTION_SIZE,
which is defined by the EventAccess interface.
Result
The purgeEvents() method deletes all of the events that match all
of the criteria you specify. If the eventGroup and eventSelector parameters
are both null, all events in the data store are deleted. Events that arrive
after the delete operation starts are not purged. The returned value is an
integer specifying how many events were deleted.
Note: 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 deleted. The default maximum purge transaction
size is 100 000.