Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-15819

CKC File connector: appendChars not used when the file doesn't exist

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Minor Minor
    • 2021-M2
    • None
    • Camel Kafka Connector
    • None
    • False
    • False
    • % %
    • Undefined

      appendChars isn't used when the file doesn't exist yet. My use-case would be that I wan't to append all messages from the topic into a single file delimited with some value, but the first message and second message are not separated.

      connector config:

      connector.class=org.apache.camel.kafkaconnector.file.CamelFileSinkConnector
      camel.sink.endpoint.fileExist=append
      tasks.max=1
      topics=mytopic
      camel.sink.endpoint.appendChars=@@@
      name=CamelFileSinkConnector
      value.converter=org.apache.kafka.connect.storage.StringConverter
      camel.sink.endpoint.fileName=output.txt
      key.converter=org.apache.kafka.connect.storage.StringConverter
      camel.sink.path.directoryName=/tmp/sink
      

      Steps to reproduce:
      0. ensure that /tmp/sink/output.txt doesn't exist yet
      1. start ckc file connector:

      $KAFKA_HOME/bin/connect-standalone.sh $KAFKA_HOME/config/connect-standalone.properties /tmp/connector.props
      

      2. publish messages to mytopic before starting ckc file connector:

      $KAFKA_HOME/bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic mytopic
      >one
      >two
      >three
      >four
      >five
      

      3. observe /tmp/sink/output.txt

      onetwo@@@three@@@four@@@five@@@
      

      The workaround would be to create file beforehand

              acosenti Andrea Cosentino
              avano@redhat.com Andrej Vano
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: