-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(exporter): export all record and value types by default
* export all record/value types if no type is explicitly listed * all configuration entries can be overridden by environment variables with the same name in upper case
- Loading branch information
Showing
7 changed files
with
137 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 43 additions & 7 deletions
50
exporter/src/main/java/io/zeebe/hazelcast/exporter/ExporterConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
exporter/src/main/java/io/zeebe/hazelcast/exporter/HazelcastRecordFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package io.zeebe.hazelcast.exporter; | ||
|
||
import io.zeebe.exporter.api.context.Context; | ||
import io.zeebe.protocol.record.RecordType; | ||
import io.zeebe.protocol.record.ValueType; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public final class HazelcastRecordFilter implements Context.RecordFilter { | ||
|
||
private final List<RecordType> enabledRecordTypes; | ||
private final List<ValueType> enabledValueTypes; | ||
|
||
public HazelcastRecordFilter(ExporterConfiguration config) { | ||
|
||
final var enabledRecordTypeList = parseAsList(config.getEnabledRecordTypes()); | ||
|
||
enabledRecordTypes = | ||
Arrays.stream(RecordType.values()) | ||
.filter( | ||
recordType -> | ||
enabledRecordTypeList.isEmpty() | ||
|| enabledRecordTypeList.contains(recordType.name())) | ||
.collect(Collectors.toList()); | ||
|
||
final var enabledValueTypeList = parseAsList(config.getEnabledValueTypes()); | ||
|
||
enabledValueTypes = | ||
Arrays.stream(ValueType.values()) | ||
.filter( | ||
valueType -> | ||
enabledValueTypeList.isEmpty() | ||
|| enabledValueTypeList.contains(valueType.name())) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
private List<String> parseAsList(String list) { | ||
return Arrays.stream(list.split(",")) | ||
.map(String::trim) | ||
.filter(item -> !item.isEmpty()) | ||
.map(String::toUpperCase) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public boolean acceptType(RecordType recordType) { | ||
return enabledRecordTypes.contains(recordType); | ||
} | ||
|
||
@Override | ||
public boolean acceptValue(ValueType valueType) { | ||
return enabledValueTypes.contains(valueType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters