co.decodable.sdk.pipeline.internal.config.StreamConfigMapping Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of decodable-pipeline-sdk Show documentation
Show all versions of decodable-pipeline-sdk Show documentation
A software development kit for implementing Apache Flink jobs and running them on Decodable
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright Decodable, Inc.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package co.decodable.sdk.pipeline.internal.config;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StreamConfigMapping {
private static final Pattern KEY_PATTERN = Pattern.compile("DECODABLE_STREAM_CONFIG_(.*)");
private final Map configsByStreamName = new HashMap<>();
private final Map configsByStreamId = new HashMap<>();
public StreamConfigMapping(Map environment) {
ObjectMapper mapper = new ObjectMapper();
for (Entry entry : environment.entrySet()) {
Matcher keyMatcher = KEY_PATTERN.matcher(entry.getKey());
if (keyMatcher.matches()) {
String streamId = keyMatcher.group(1);
try {
Map config =
mapper.readValue(entry.getValue(), new TypeReference
© 2015 - 2025 Weber Informatics LLC | Privacy Policy