Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-7769

Debezium Server Distribution Non configurable StreamNameMapper

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • Backlog
    • 2.6.0.Final
    • debezium-server
    • None
    • False
    • None
    • False

      What Debezium connector do you use and what version?

      debezium-server-dist-2.6.0.Final.tar.gz
      (and or same v. container image)

      What is the connector configuration?

      ~Irrelevant (but using mysql source, pubsub sink)

      What is the captured database version and mode of depoyment?

      local mariadb 10.6.0 container

      What behaviour do you expect?

      Ability to add a library jar to debezium server deployment with custom io.debezium.server.StreamNameMapper

      bean implementation

      What behaviour do you see?

      Jar with custom io.debezium.server.StreamNameMapper added to server distribution lib folder is not loaded / not treated as bean archive.

      YES
      META-INF\beans.xml is present

      BUT
      since quarkus resolves cdi/beans at build time, any additional jars in lib dir are ignored for purposes of CDI/beans definitions.

      Do you see the same behaviour using the latest relesead Debezium version?

      yes

      Do you have the connector logs, ideally from start till finish?

      (You might be asked later to provide DEBUG/TRACE level log)

      2024-04-09 15:27:25,943 INFO  [io.deb.ser.BaseChangeConsumer] (main) Using 'io.debezium.server.BaseChangeConsumer$$Lambda$237/0x0000000840309840@21079a12' stream name mapper

      Even though jar with:

      package com.ugp.ws.group.stream;
      
      import jakarta.enterprise.context.Dependent;
      import io.debezium.server.StreamNameMapper;
      
      @Dependent
      public class FirstSegmentNameMapper implements StreamNameMapper {
          @Override
          public String map(String topic) {
              return topic.split("\\.")[0];
          }
      } 

      And META-INF/beans.xml is added to distribution lib dir.

       

      How to reproduce the issue using our tutorial deployment?

      Maybe not tutorial.
      BUT:

      • download standard debezium server distro/container image
      • checkout debezium-examples and build debezium-server-name-mapper
      • copy from debezium-server-name-mapper/target/debezium-server-name-mapper-1.0.0-SNAPSHOT.jar TO container/or distro lib directory
      • start container/or distro

      Observe the default x->x lambda used log:
      > 2024-04-10 14:34:22,844 INFO  [io.deb.ser.BaseChangeConsumer] (main) Using 'io.debezium.server.BaseChangeConsumer$$Lambda$234/0x0000000840316440@5b9396d3' stream name mapper

      Feature request or enhancement

      Allow for a way to provide custom StreamNameMapper to be used in debezium server distro and container image.

      Which use case/requirement will be addressed by the proposed feature?

      Debezium server / distro allowing customiszation of StreamNameMapper
      ~as documented in docs.

      Implementation ideas (optional)

      Maybe add a cdi provider for StreamNameMapper that would look for a app property containing a class name for StreamNameMapper implementation.
      That provider if prop is present would use standard reflection to load implementation from classpath (skipping quarkus arc/cdi). 

      Otherwise could just return the lambda or maybe there's a way for provider to lookup other available impl. beans.

            Unassigned Unassigned
            lwysocki Lukas Wysocki
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: