Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommend loading as an external exporter via the JAR path for Zeebe 1.0.1 #188

Merged
merged 2 commits into from
Jun 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,35 @@ At the moment, the only guarantees for backwards compatibility are:
The quickest way to get started is:

1. Download the latest release (`zeebe-kafka-exporter-*-jar-with-dependencies.jar`).
1. Copy it to the `lib/` folder of your Zeebe brokers.
1. Copy the contents of the configuration from `exporter.yml` into your Zeebe `application.yml`
1. Copy it somewhere accessible the Zeebe broker
1. Add the following to your Zeebe broker's `application.yaml`

```yaml
zeebe:
broker:
exporters:
kafka:
className: io.zeebe.exporters.kafka.KafkaExporter
jarPath: /path/to/zeebe-kafka-exporter-3.0.0-jar-with-dependencies.jar
args:
producer:
# update this to point to your Kafka brokers
servers: "kafka-1:9092,kafka-2:9092"
```

1. Update the configuration's list of servers to point to your Kafka instances.

The next time you start your Zeebe cluster, all event-type records will be exported to their
respective Kafka topics.
respective Kafka topics. See [exporter/exporter.yml](/exporter/exporter.yml) for a fully commented
configuration file example.

> NOTE: there's a bug in Zeebe which prevents this exporter from being loaded in an isolated way.
> See [this issue](https://github.com/camunda-cloud/zeebe/issues/4196) for more. When that is fixed,
> then the exporter should be loaded as any other external exporter.
> NOTE: pre Zeebe 1.0.1, there was a bug in Zeebe which prevented this exporter from being loaded in
> an isolated way. See [this issue](https://github.com/camunda-cloud/zeebe/issues/4196) for more. If
> that's the case for you, then you _must_ place this exporter in the `lib/` folder of your Zeebe
> broker directory - by default that would be `/usr/local/zeebe/lib`. It will then be automatically
> available on the classpath, and you can omit the `jarPath` configuration option. This is not
> recommended however, and if you're on Zeebe 1.0.1 or greater, you should use the method described
> above.

## Usage

Expand Down Expand Up @@ -338,6 +357,9 @@ zeebe:
exporters:
kafka:
className: io.zeebe.exporters.kafka.KafkaExporter
# Update this path to the location of the JAR
# Note that this must be visible to the broker process
jarPath: /path/to/zeebe-kafka-exporter-3.0.0-jar-with-dependencies.jar
args:
# Controls the number of records to buffer in a single record batch before forcing a flush. Note
# that a flush may occur before anyway due to periodic flushing. This setting should help you
Expand Down
3 changes: 3 additions & 0 deletions exporter/exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ zeebe:
exporters:
kafka:
className: io.zeebe.exporters.kafka.KafkaExporter
# Update this path to the location of the JAR
# Note that this must be visible to the broker process
jarPath: /path/to/zeebe-kafka-exporter-3.0.0-jar-with-dependencies.jar
args:
# Controls the number of records to buffer in a single record batch before forcing a flush. Note
# that a flush may occur before anyway due to periodic flushing. This setting should help you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.protocol.record.Record;
import io.zeebe.containers.ZeebeContainer;
import io.zeebe.containers.ZeebeDefaults;
import io.zeebe.exporters.kafka.serde.RecordDeserializer;
import io.zeebe.exporters.kafka.serde.RecordId;
import io.zeebe.exporters.kafka.serde.RecordIdDeserializer;
Expand Down Expand Up @@ -271,7 +272,8 @@ private DebugHttpExporterClient getLazyDebugExporter() throws MalformedURLExcept

@SuppressWarnings("OctalInteger")
private ZeebeContainer newZeebeContainer() {
final var container = new ZeebeContainer();
final var container =
new ZeebeContainer(ZeebeDefaults.getInstance().getDefaultDockerImage().withTag("1.0.1"));
final var exporterJar = MountableFile.forClasspathResource("zeebe-kafka-exporter.jar", 0775);
final var exporterConfig = MountableFile.forClasspathResource("exporters.yml", 0775);
final var loggingConfig = MountableFile.forClasspathResource("log4j2.xml", 0775);
Expand All @@ -289,7 +291,7 @@ private ZeebeContainer newZeebeContainer() {
.withEnv(
"LOG4J_CONFIGURATION_FILE",
"/usr/local/zeebe/config/log4j2.xml,/usr/local/zeebe/config/log4j2-exporter.xml")
.withCopyFileToContainer(exporterJar, "/usr/local/zeebe/lib/zeebe-kafka-exporter.jar")
.withCopyFileToContainer(exporterJar, "/usr/local/zeebe/exporters/zeebe-kafka-exporter.jar")
.withCopyFileToContainer(exporterConfig, "/usr/local/zeebe/config/exporters.yml")
.withCopyFileToContainer(loggingConfig, "/usr/local/zeebe/config/log4j2-exporter.xml")
.withEnv("SPRING_CONFIG_ADDITIONAL_LOCATION", "file:/usr/local/zeebe/config/exporters.yml")
Expand Down
1 change: 1 addition & 0 deletions qa/src/test/resources/exporters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ zeebe:
port: 8000
kafka:
className: io.zeebe.exporters.kafka.KafkaExporter
jarPath: /usr/local/zeebe/exporters/zeebe-kafka-exporter.jar
args:
maxBatchSize: 100
maxBlockingTimeoutMs: 1000
Expand Down
2 changes: 1 addition & 1 deletion qa/src/test/resources/simplelogger.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.slf4j.simpleLogger.logFile=System.out
org.slf4j.simplerLogger.showShortLogName=true
org.slf4j.simpleLogger.defaultLogLevel=info
org.slf4j.simpleLogger.log.io.zeebe.exporters.kafka.qa.KafkaExporterIT=debug
org.slf4j.simpleLogger.log.io.zeebe.exporters.kafka.qa.KafkaExporterIT.zeebeContainer=info
org.slf4j.simpleLogger.log.io.zeebe.exporters.kafka.qa.KafkaExporterIT.zeebeContainer=warn
org.slf4j.simpleLogger.log.io.zeebe.exporters.kafka.qa.KafkaExporterIT.kafkaContainer=warn
org.slf4j.simpleLogger.log.org.apache=warn
org.slf4j.simpleLogger.log.kafka=warn