#!/usr/bin/env bash
SAMPLEDATA="${SAMPLEDATA:-1}"

if echo "$SAMPLEDATA" | egrep -sq "true|TRUE|y|Y|yes|YES|1"; then
    pushd /usr/share/landoop/sample-data

    zcat ais.txt.gz | \
        kafka-avro-console-producer \
            --broker-list localhost:9092 \
            --topic position-reports \
            --property parse.key=true \
            --property key.schema="$(cat classAPositionReportSchemaKey.json)" \
            --property value.schema="$(cat classAPositionReportSchema.json)"

    # # Without key
    # zcat ais-nokey.txt.gz | \
    #     kafka-avro-console-producer \
    #         --broker-list localhost:9092 \
    #         --topic position-reports-nokey \
    #         --property value.schema="$(cat classAPositionReportSchema.json)"

    popd
fi

#!/usr/bin/env bash
SAMPLEDATA="${SAMPLEDATA:-1}"

if echo "$SAMPLEDATA" | egrep -sq "true|TRUE|y|Y|yes|YES|1"; then
    pushd /usr/share/landoop/sample-data

    kafka-topics \
        --zookeeper localhost:2181 \
        --topic position-reports \
        --partition 5 \
        --replication 1 \
        --create

    zcat ais.txt.gz | \
        kafka-avro-console-producer \
            --broker-list localhost:9092 \
            --topic position-reports \
            --property parse.key=true \
            --property key.schema="$(cat classAPositionReportSchemaKey.json)" \
            --property value.schema="$(cat classAPositionReportSchema.json)"

    # # Without key
    # zcat ais-nokey.txt.gz | \
    #     kafka-avro-console-producer \
    #         --broker-list localhost:9092 \
    #         --topic position-reports-nokey \
    #         --property value.schema="$(cat classAPositionReportSchema.json)"

    popd
fi

Use 5 partitions for position-reports.
Use 5 partitions for position-reports.

Signed-off-by: Marios Andreopoulos <279a4cf6d7f8da1ddc113bb946b9273d9d938683@andmarios.com>
