jcustenborder / kafka-connect-transform-common

Common Transforms for Kafka Connect.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChangeTopicCase works strange

rkudryashov opened this issue · comments

Hi, thanks for this library. I'm trying to lower case topic name: by default it is outbox.event.Book, and I want it to become outbox.event.book. (the topic name itself is created by outbox event router SMT). But after applying the following connector config:

    "transforms.topicCase.type": "com.github.jcustenborder.kafka.connect.transform.common.ChangeTopicCase",
    "transforms.topicCase.from": "UPPER_CAMEL",
    "transforms.topicCase.to"  : "LOWER_HYPHEN"

the topic name became outbox.event.-book

Also, if I use LOWER_UNDERSCORE topic name becomes outbox.event._book; by LOWER_CAMEL option topic name remains outbox.event.Book

I think the problem is that I need to convert only one part of the topic name

hi @rkudryashov!

This particular transformation is a wrapper around google guava and CaseFormat. If you look at the enumeration it gives you some examples of what it will do. For example it handles the case of TestTopic to test-topic but doesn't have a format already to handle Test.Topic. I added a quick transform that should help you out. Take a look at LowerCaseTopic, this will take the string of a topic name and lowercase the whole string. This would handle the example you specified.

Thanks @jcustenborder

Also, how I can install the latest version? For example, the 0.1.0.54 version can be downloaded from https://www.confluent.io/hub/jcustenborder/kafka-connect-transform-common. Are you planning to publish the fix or do I need to build jar manually? And is it possible to install this transformation to custom Docker Debezium image with docker-maven-download, for example:

RUN docker-maven-download confluent kafka-connect-transform-common "0.1.0.54" <md5>

It looks like it hasn't been updated yet. My build process sends the output of the build to the Confluent partner team and they upload the new binary. It usually happens within 24 hours. As a work around you could run mvn clean package to get the output needed. It'll be the zip in the target/components directory.

Thought I'd chime in here as I just now encountered the same behavior (I'm also using debeizum's EventRouter for Outbox Pattern SMT).

The LowerCaseTopic works well if it is a simple word in the final part like "Book" and I will use the same SMT for now. Are there plans to support "LOWER-UNDERSCORE" and "LOWER_HYPHEN" for the case outlined in this issue? For example: outbox.event.TestTopic -> outbox.event.test-topic (it currently becomes outbox.event.-test-topic)

Thanks for the library, it's very useful!