Newly created events can be added to the event catalog.
Why and when to perform this task
After you have created a new event definition and populated it with
property descriptions and extended data element descriptions, you can add
it to the event catalog. Once added to the event catalog, an event definition
cannot be modified, but it can be replaced.
Note: If WebSphere security is
enabled, the application user ID must be mapped to the catalogAdministrator
role to add event definitions to the event catalog.
Steps for this task
To add an event definition to the event catalog, use the addEventDefinition
method. boolean result = eventCatalog.addEventDefinition(definition, replace)
The
parameters of this method are as follows:
- definition
- The event definition you want to add. This must be a valid instance of
EventDefinition.
- replace
- A Boolean value indicating whether the specified event definition replaces
an existing definition that has the same name.
If the replace parameter is false,
the name of the specified event definition must not match that of any existing
event definition in the catalog. If it does, an EventDefinitionExistsException
exception is thrown.
If the replace parameter
is true, the new event definition replaces any existing event
definition with the same name that is already in the catalog. However, to
preserve the inheritance hierarchy, the new event definition must name the
same parent as the old event definition; otherwise, a ParentNotValidException
exception is thrown.
Result
The returned Boolean indicates whether an existing event definition
was replaced. This is equal to true only if replace is
equal to true and an event definition with the same name
was replaced by the new definition.
When an event definition is added
to the event catalog, the event catalog sends an event to the event server
notifying event consumers that this change occurred. See
Change notification.
Note: If
you attempt to add an event definition that violates inheritance rules, an
InheritanceNotValidException exception is thrown and the event definition
is not added to the catalog. This can happen if a new event definition overrides
inherited property or extended data element descriptions in ways that are
not valid, or if replacing an existing event definition would cause descendants
to override inherited descriptions in ways that are not valid. For more information,
see
Event catalog inheritance.