Class TaskHelper
- java.lang.Object
-
- org.apache.camel.kafkaconnector.utils.TaskHelper
-
public final class TaskHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringbuildUrl(org.apache.camel.CamelContext camelContext, Map<String,String> props, String componentSchema, String endpointPropertiesPrefix, String pathPropertiesPrefix)Try to build a url of a CamelEndpoint.static Map<String,String>combineDefaultAndLoadedProperties(Map<String,String> defaultProps, Map<String,String> loadedProps)Combines default properties with loaded properties with the following logic: 1) loaded properties overwrite default properties.static voidlogRecordContent(org.slf4j.Logger logger, org.apache.camel.LoggingLevel level, org.apache.kafka.connect.connector.ConnectRecord<?> record)
-
-
-
Method Detail
-
buildUrl
public static String buildUrl(org.apache.camel.CamelContext camelContext, Map<String,String> props, String componentSchema, String endpointPropertiesPrefix, String pathPropertiesPrefix) throws URISyntaxException
Try to build a url of a CamelEndpoint.- Parameters:
camelContext- theCamelContextused to retrieve an instance of a EndpointUriFactory for the given component schema.props- properties used to build the url in the form of a key -> valueMap.componentSchema- the schema name of the CamelComponentused to build the CamelEndpointurl.endpointPropertiesPrefix- prefix of all the CamelEndpointproperties.pathPropertiesPrefix- prefix of all the properties used in the CamelEndpointpath.- Returns:
- A String representing the built url.
- Throws:
URISyntaxException
-
combineDefaultAndLoadedProperties
public static Map<String,String> combineDefaultAndLoadedProperties(Map<String,String> defaultProps, Map<String,String> loadedProps)
Combines default properties with loaded properties with the following logic: 1) loaded properties overwrite default properties. 2) default properties that starts with a loaded property are removed. Example: default properties: defaultProperty=defaultValue overwrittenDefaultProperty=defaultValue camel.component.x.objectProperty=#class:my.package.MyClass camel.component.x.objectProperty.removedDefaultField=defaultValue camel.component.x.defaultProperty=defaultValue loaded properties: overwrittenDefaultProperty=loadedValue camel.component.x.objectProperty=#class:my.package.MyOtherClass camel.component.x.objectProperty.loadedField=loadedValue camel.component.x.loadedProperty=loadedValue will result in: defaultProperty=defaultValue overwrittenDefaultProperty=loadedValue camel.component.x.objectProperty=#class:my.package.MyOtherClass camel.component.x.objectProperty.anotherField=loadedValue camel.component.x.loadedProperty=loadedValue camel.component.x.defaultProperty=defaultValue See org.apache.camel.kafkaconnector.utils.TaskHelperTests for some examples.- Parameters:
defaultProps- RuntimeCamelCatalog used to build the url.loadedProps- properties used to build the url in the form of a key -> valueMap.
-
logRecordContent
public static void logRecordContent(org.slf4j.Logger logger, org.apache.camel.LoggingLevel level, org.apache.kafka.connect.connector.ConnectRecord<?> record)
-
-