Companies like Confluent provide command line utilities for producing/consumer Kafka topics. However, these tools are extremely difficult to use when other technologies are introduced, e.g. avro, or attempting to debug your application by attempting to parse globs of unformatted json.
Depending on deployment strategies, developers and QA are not able to use these tools in deployed environment for testing/debugging.
This service provides similar functionality with a more user friendly interface wrapped in an easily deployable micro-service.
Similar to the command line tools Kadmin can spin up consumers and producers on the fly.
Consumers keep a queue of the latest n
(default 100) messages from a topic. When a consumer spins up, it starts with the auto.offset.reset=latest
configuration. After an
initialization poll, the consumer will seek to max(po - n / pc, 0)
for each partition where
po
is the offset for that partition and pc
is the total number of partitions.
This allows the consumer to pull the latest messages from each partition.
Producers behave the same as command line tools. Not that depending on your kafka/schema registry configurations, you might need to create topics and schemas manually.
Kadmin uses Kafka 0.9.* and Confluent 3.*. Follow the confluent quickstart guide to get your local environment setup.
Kadmin requires Java 1.8+.
See the Configuration section for a full list of configurations, descriptions, and default values.
/dist
directory.java -jar shared-kafka-admin-micro-0.1.0.jar --spring.profiles.active=desired,Spring,profiles
Example
cd <base>
cd dist
cp ../application.properties .
java -jar shared-kafka-admin-micro-*.jar --spring.profiles.active=kadmin,local
./gradlew bootRun
or use your cli/ide to execute com.bettercloud.kadmin.Application#main
https://cloud.docker.com/u/bettercloud/repository/docker/bettercloud/kadmin
docker run -d -name kadmin bettercloud/kadmin
docker-compose up
Take the following variables into consideration when running the container:
ZOOKEEPER_HOST
: zookeeper hostKAFKA_HOST
: kafka hostSECURITY_PROTOCOL
: security protocol (SSL or PLAINTEXT)TRUST_STORE_LOCATION
: absolute location of the truststore jks fileTRUST_STORE_PASSWORD
: truststore passwordKEY_STORE_LOCATION
: absolute location of the keystore jks fileKEY_STORE_PASSWORD
: keystore passwordKEY_PASSWORD
: key password./gradlew clean build
build/libs
e.g. build/libs/shared-kafka-admin-micro-0.1.0.jar
<base>/application.properties
then copy that file to the same directory as the executable jar.java -jar shared-kafka-admin-micro-0.1.0.jar --spring.profiles.active=desired,Spring,profiles
Example
cd <base>
rm -rf dist
mkdir dist
./gradlew clean build
cp build/libs/shared-kafka-admin-micro-*.jar dist/
cp application.properties dist/
cd dist
java -jar shared-kafka-admin-micro-*.jar --spring.profiles.active=kadmin,local
Once the consumer has been started, you have the following options.
Allows management of active connections to brokers. Displays information about topics currently being consumed. Provides actions for each active consumer
Also, allows for clean disposal of producers.
<base>/application.properties
=> External configuration (preferred)<base>/src/resources/application.properties
=> Class path configuration (built into executable)The consumer and producer has reasonable defaults, but these can be overridden using configurations from http://kafka.apache.org/documentation.html#newconsumerconfigs.
Config | Description | Default | Possible Values |
---|---|---|---|
server.contextPath | The following config sets the spring context path. You will access the application at http:// |
null |
Any valid url path element e.g. /kadmin |
server.port | The port that the tomcat service will listen on. | 8080 |
Any valid port |
ff.producer.enabled | Toggles read only mode i.e. Kafka producers are disabled. You can use the following Spring profile or the raw config. | false |
true , false |
ff.customKafkaUrl.enabled | Allows custom urls to be used for Kafka and Service Registry for each producer and consumer. | false |
true , false |
kafka.host | If ff.customKafkaUrl.enabled is disabled then you need to configure the default endpoints using the following configs. kafka.host is a comma separated list of kafka brokers. |
localhost:9092 |
Valid hosts separated by commas. |
schema.registry.url | Allows custom urls to be used for Kafka and Service Registry for each producer and consumer. | http://localhost:8081 |
Any valid host url |
Note that changes to the major version (i.e. the first number) represent possible breaking changes, and may require modifications in your code to migrate. Changes to the minor version (i.e. the second number) should represent non-breaking changes. The third number represents any very minor bugfix patches.
0.9.1 - Bug Fixes
0.9.0 - Initial public release.
Pull requests are welcomed for bugfixes or small enhancements. For more complex changes please open up an issue to discuss it first.
All code changes should include unit test and/or integration test coverage as appropriate. Unit tests are any that can be run in isolation, with no external dependencies. Integration tests are those which require kafka, zookeeper, and/or a schema registry instance (at least a Dev instances) up and running.
Unit tests are located under the src/test
directory, and can be run with the Grade unitTest
task.
Integration tests are located under the src/test-integration
directory, and can be run with the Gradle integrationTest
task. See the additional README.md
file in this directory for more detailed information on the kafka, zookeeper, schema registry, and avro required to run the integration test suite.
// coming soon...
Please contact david.esposito@bettercloud.com if you need this documentation sooner than later.
// coming soon...
Please contact david.esposito@bettercloud.com if you need this documentation sooner than later.
The MIT License (MIT)
Copyright (c) 2016 BetterCloud
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please contact david.esposito@bettercloud.com with any questions, or create an issue on Github with any bugs or feature requests.