Skip to content

Commit

Permalink
rebasing to latest
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Kondaka <[email protected]>
  • Loading branch information
Krishna Kondaka committed Dec 12, 2023
1 parent ebc96b1 commit 6cd63f2
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
import org.opensearch.dataprepper.model.processor.AbstractProcessor;
import org.opensearch.dataprepper.model.record.Record;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collection;
import java.util.List;

import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT;

public abstract class AbstractStringProcessor<T> extends AbstractProcessor<Record<Event>, Record<Event>> {
private final List<T> entries;
static final Logger LOG = LoggerFactory.getLogger(AbstractStringProcessor.class);

@DataPrepperPluginConstructor
public AbstractStringProcessor(final PluginMetrics pluginMetrics, final StringProcessorConfig<T> config) {
Expand All @@ -35,18 +41,20 @@ public Collection<Record<Event>> doExecute(final Collection<Record<Event>> recor

private void performStringAction(final Event recordEvent)
{
for(T entry : entries) {


final String key = getKey(entry);
try {
for(T entry : entries) {
final String key = getKey(entry);

if(recordEvent.containsKey(key)) {
final Object value = recordEvent.get(key, Object.class);
if(recordEvent.containsKey(key)) {
final Object value = recordEvent.get(key, Object.class);

if(value instanceof String) {
performKeyAction(recordEvent, entry, (String) value);
if(value instanceof String) {
performKeyAction(recordEvent, entry, (String) value);
}
}
}
} catch (Exception e) {
LOG.error(EVENT, "Exception while performing String action", e);
}
}

Expand Down

0 comments on commit 6cd63f2

Please sign in to comment.