-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add additional properties to Kafka connectors, improve logging
- Loading branch information
1 parent
727d146
commit cfb5f0e
Showing
14 changed files
with
232 additions
and
27 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
55 changes: 55 additions & 0 deletions
55
...org/apache/streampipes/extensions/connectors/kafka/migration/KafkaAdapterMigrationV2.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,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.streampipes.extensions.connectors.kafka.migration; | ||
|
||
import org.apache.streampipes.extensions.api.extractor.IStaticPropertyExtractor; | ||
import org.apache.streampipes.extensions.api.migration.IAdapterMigrator; | ||
import org.apache.streampipes.extensions.connectors.kafka.adapter.KafkaProtocol; | ||
import org.apache.streampipes.extensions.connectors.kafka.shared.kafka.KafkaConfigProvider; | ||
import org.apache.streampipes.model.connect.adapter.AdapterDescription; | ||
import org.apache.streampipes.model.extensions.svcdiscovery.SpServiceTagPrefix; | ||
import org.apache.streampipes.model.migration.MigrationResult; | ||
import org.apache.streampipes.model.migration.ModelMigratorConfig; | ||
import org.apache.streampipes.sdk.StaticProperties; | ||
import org.apache.streampipes.sdk.helpers.CodeLanguage; | ||
import org.apache.streampipes.sdk.helpers.Labels; | ||
|
||
public class KafkaAdapterMigrationV2 implements IAdapterMigrator { | ||
@Override | ||
public ModelMigratorConfig config() { | ||
return new ModelMigratorConfig( | ||
KafkaProtocol.ID, | ||
SpServiceTagPrefix.ADAPTER, | ||
1, | ||
2 | ||
); | ||
} | ||
|
||
@Override | ||
public MigrationResult<AdapterDescription> migrate(AdapterDescription element, | ||
IStaticPropertyExtractor extractor) throws RuntimeException { | ||
element.getConfig().add( | ||
StaticProperties | ||
.codeStaticProperty(Labels.withId(KafkaConfigProvider.ADDITIONAL_PROPERTIES), | ||
CodeLanguage.None, | ||
"# key=value, comments are ignored") | ||
); | ||
return MigrationResult.success(element); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...va/org/apache/streampipes/extensions/connectors/kafka/migration/KafkaSinkMigrationV2.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 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.streampipes.extensions.connectors.kafka.migration; | ||
|
||
import org.apache.streampipes.extensions.api.extractor.IDataSinkParameterExtractor; | ||
import org.apache.streampipes.extensions.api.migration.IDataSinkMigrator; | ||
import org.apache.streampipes.extensions.connectors.kafka.shared.kafka.KafkaConfigProvider; | ||
import org.apache.streampipes.extensions.connectors.kafka.sink.KafkaPublishSink; | ||
import org.apache.streampipes.model.extensions.svcdiscovery.SpServiceTagPrefix; | ||
import org.apache.streampipes.model.graph.DataSinkInvocation; | ||
import org.apache.streampipes.model.migration.MigrationResult; | ||
import org.apache.streampipes.model.migration.ModelMigratorConfig; | ||
import org.apache.streampipes.sdk.StaticProperties; | ||
import org.apache.streampipes.sdk.helpers.CodeLanguage; | ||
import org.apache.streampipes.sdk.helpers.Labels; | ||
|
||
public class KafkaSinkMigrationV2 implements IDataSinkMigrator { | ||
|
||
@Override | ||
public ModelMigratorConfig config() { | ||
return new ModelMigratorConfig( | ||
KafkaPublishSink.ID, | ||
SpServiceTagPrefix.DATA_SINK, | ||
1, | ||
2 | ||
); | ||
} | ||
|
||
@Override | ||
public MigrationResult<DataSinkInvocation> migrate(DataSinkInvocation element, | ||
IDataSinkParameterExtractor extractor) throws RuntimeException { | ||
element.getStaticProperties().add( | ||
StaticProperties | ||
.codeStaticProperty(Labels.withId(KafkaConfigProvider.ADDITIONAL_PROPERTIES), | ||
CodeLanguage.None, | ||
"# key=value, comments are ignored") | ||
); | ||
return MigrationResult.success(element); | ||
} | ||
} |
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
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
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
38 changes: 38 additions & 0 deletions
38
...fka/src/main/java/org/apache/streampipes/messaging/kafka/config/SimpleConfigAppender.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,38 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.streampipes.messaging.kafka.config; | ||
|
||
import org.apache.streampipes.commons.exceptions.SpRuntimeException; | ||
|
||
import java.util.Map; | ||
import java.util.Properties; | ||
|
||
public class SimpleConfigAppender implements KafkaConfigAppender { | ||
|
||
private final Map<String, String> configs; | ||
|
||
public SimpleConfigAppender(Map<String, String> configs) { | ||
this.configs = configs; | ||
} | ||
|
||
@Override | ||
public void appendConfig(Properties props) throws SpRuntimeException { | ||
configs.forEach(props::setProperty); | ||
} | ||
} |
Oops, something went wrong.