ITargetMonitor
The target monitor is used to monitor the registration and de-registration of targets.
The target monitor is part of a target registry. It is available via a getter method.
ITargetMonitor monitor = target.getMonitor();
You can add observers with single or multiple filters:
void addObserver(@NotNull CTargetAddress aObserver, @NotNull CTargetAddressFilter aFilter); void addObserver(@NotNull CTargetAddress aObserver, CTargetAddressFilter @NotNull [] aFilter);
Filters can also be removed again.
void removeFilter(@NotNull CTargetAddress aObserver, @NotNull CTargetAddressFilter aFilter); void removeFilter(@NotNull CTargetAddress aObserver, @NotNull CTargetAddressFilter[] aFilter);
It is also possible to remove an observer including all filters.
void removeObserver(@NotNull CTargetAddress aObserver);
The filters
Filters (of type CTargetAddressFilter) contain all components of a target address:
- The target ID
- The namespace ID
- The node ID
- The segment ID
A filter is positive in comparison if filled fields match. Thus, if the node ID and segment ID are specified, the observer is notified of target events, that affect targets that have the same node ID and segment ID.
Multiple filters can be specified per observer.
Notification
If a target is registered, the observers will receive the message CRecordTargetMonitorNotifyTargetRegistered.
If a target is deregistered, the observers receive the message CRecordTargetMonitorNotifyTargetDeregistered.