Package org.eso.ias.kafkautils
Class KafkaIasiosConsumer
java.lang.Object
org.eso.ias.kafkautils.SimpleKafkaIasiosConsumer
org.eso.ias.kafkautils.KafkaIasiosConsumer
- All Implemented Interfaces:
KafkaStringsConsumer.StringsConsumer
Extends
SimpleKafkaIasiosConsumer
providing filtering by IDs and types.
Filtering is based on the ID of the IASIOs _and_ the IASValue type:
- if the ID of the received String is contained in acceptedIds
then the IASIO is forwarded to the listener otherwise it is rejected.
- if the type of the IASValue
is contained in acceptedTypes
then the IASIO is forwarded to the listener otherwise is rejected.
If the caller does not set any filter, then all the received IASIOs will be forwarded to the listener. IDs and type are evaluated in AND.
- Author:
- acaproni
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eso.ias.kafkautils.SimpleKafkaIasiosConsumer
SimpleKafkaIasiosConsumer.IasioListener
-
Field Summary
Fields inherited from class org.eso.ias.kafkautils.SimpleKafkaIasiosConsumer
seekIfOlderThan, SeekIfOlderThanProName
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Accepts or rejects a IASValue against the filters, if setvoid
addIdsToFilter
(Set<String> idsToAdd) Add the passed IDs to the filtervoid
addTypesToFilter
(Set<IASTypes> typesToAdd) Add the passed alarm types to the filtervoid
Entirely remove the filteringGetterGettervoid
Set the filtering to the passed set of IDs, discarding the existing filters, if any.Methods inherited from class org.eso.ias.kafkautils.SimpleKafkaIasiosConsumer
getNumOfProcessedRecords, setUp, setUp, startGettingEvents, stringsReceived, tearDown
-
Constructor Details
-
KafkaIasiosConsumer
public KafkaIasiosConsumer(String servers, String topicName, String consumerID, Set<String> idsOfIDsToAccept, Set<IASTypes> idsOfTypesToAccept) Build a FilteredStringConsumer with the passed initial filters.- Parameters:
servers
- The kafka servers to connect totopicName
- The name of the topic to get events fromconsumerID
- the ID of the consumeridsOfIDsToAccept
- The IDs of the IASIOs to forward to the listeneridsOfTypesToAccept
- The types of the IASIOs to forward to the listener
-
-
Method Details
-
accept
Accepts or rejects a IASValue against the filters, if set- Overrides:
accept
in classSimpleKafkaIasiosConsumer
- Parameters:
iasio
- The IASValue to accept or discard- Returns:
- true if teh value is accpted; false otherwise
-
clearFilter
public void clearFilter()Entirely remove the filtering -
addIdsToFilter
Add the passed IDs to the filter- Parameters:
idsToAdd
- The filters to add
-
addTypesToFilter
Add the passed alarm types to the filter- Parameters:
typesToAdd
- The types to add
-
setFilter
Set the filtering to the passed set of IDs, discarding the existing filters, if any.- Parameters:
idsToAccept
- The new set of IDs for filtering; ifnull
or empty the filtering by IDs is removedtypesToAccept
- The new set of types for filtering ifnull
or empty the filtering by types is removed
-
getAcceptedIds
Getter- Returns:
- the unmodifiable set of accepted IDs
-
getAcceptedTypes
Getter- Returns:
- the unmodifiable set of accepted IAS types
-