The AzkarraApplication is the top-level concept that is used to bootstrap an Azkarra Streams application.

Its main responsibility is to initialize an AzkarraContext using a user-defined configuration which describes the StreamsExecutionEnvironments and the streams applications to be executed.

The AzkarraApplication is also responsible for deploying an embedded HTTP server (if enable)

1 Creating a new AzkarraApplication

AzkarraApplication application = new AzkarraApplication();

2 Auto-configuration application

The AzkarraApplication allows you to automatically configure and assemble the internal AzkarraContext, StreamsExecutionEnvironment and TopologyProvider instances using the AzkarraConf class.

AzkarraConf azkarraConf = AzkarraConf.create("application");
AzkarraApplication application = new AzkarraApplication()

2.1 Configuring AzkarraContext

azkarra {
  // The context configuration
  context {
    // The default configuration for streams application.
    streams {
      bootstrap.servers = "localhost:9092"
      default.key.serde = "org.apache.kafka.common.serialization.Serdes$StringSerde"
      default.value.serde = "org.apache.kafka.common.serialization.Serdes$StringSerde"

2.2 Configuring components to register

Complete example (using HOCON format):

azkarra {
  // Manually defines the providers to be registered
  components = [


2.3 Configuring StreamsExecutionEnvironment and TopologyProvider

The azkarra.environments property allows you to list the StreamsExecutionEnvironment to initialize and configure.

Here are the properties to use:

Property Type Description
name string The name of the environment
config config The configuration of the environment
jobs Array[Job] The list of Topologyprovider to add to execute in the environment (a.k.a job)

Moreover, you can declared the list of TopologyProvider to be registered into a StreamsExecutionEnvironment using the following properties:

Property Type Description
name string A short name which is used for identifying the streams job.
description string A optional description of the streams job.
topology string The fully qualified class name of the topology or an alias.
config config The props used to configure both KafkaStreams and TopologyProvider instances.
azkarra {
  // Create a default environment for running the WordCountTopology
  environments = [
      name: "__default"
      config = {}
      jobs = [
          name = "word-count-demo"
          description = "Kafka Streams WordCount Demo"
          topology =  "WordCountTopology"
          config = {}

3 Enabling component-scan

Azkarra provides a simple mechanism to search for components present in the classpath or in external directories.

Any class annotated with @Component or @Factory will be scanned and automatically registered to the AzkarraContext.

The component-scan can be enable programmatically through the method AzkarraApplication#setEnableComponentScan. To automatically start all registered TopologyProviver, you must also enable auto-start.

Code snippet for enabling component scan :


4 Auto-starting topologies

By enabling auto-start all TopologyProvider that was registered during component-scanning will be automatically added to the given StreamExecutionEnvironment.

application.setAutoStart(true, "__default");

5 The @AzkarraStreamsApplication annotation

Another way to initialize and configure an AzkarraApplication is to use annotations. Therefore, you can simply annotated you main class with @AzkarraStreamsApplication and initialize your AzkarraApplication as follows:

public class SimpleStreamsApp {

    public static void main(final String[] args) {, args);

The @AzkarraStreamsApplication is a convenience annotation that adds all of the following:

  • @EnableAutoConfig: Tells Azkarra to auto-configure internal AzkarraContext
  • @EnableAutoStart: Tells Azkarra to automatically start any registered TopologyProvider using the default environment.
  • @EnableEmbeddedHttpServer: Tells Azkarra to start the embedded http-server.
  • @ComponentScan: Tells Azkarra to look for classes annotated with @Component in the current package.