Class TaskHelper

java.lang.Object
org.apache.camel.kafkaconnector.utils.TaskHelper

public final class TaskHelper extends Object
  • Method Details

    • 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 Camel Endpoint.
      Parameters:
      camelContext - the CamelContext used 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 -> value Map.
      componentSchema - the schema name of the Camel Component used to build the Camel Endpoint url.
      endpointPropertiesPrefix - prefix of all the Camel Endpoint properties.
      pathPropertiesPrefix - prefix of all the properties used in the Camel Endpoint path.
      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 -> value Map.
    • logRecordContent

      public static void logRecordContent(org.slf4j.Logger logger, org.apache.camel.LoggingLevel level, org.apache.kafka.connect.connector.ConnectRecord<?> record)