Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mikekenneth
Created November 11, 2021 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikekenneth/ac71f2cb3b86398c757cf4e4078a0373 to your computer and use it in GitHub Desktop.
Save mikekenneth/ac71f2cb3b86398c757cf4e4078a0373 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
###########################################################################
##### $Author Mike Houngbadji (mike.kenneth47@gmail.com)
# $Description: data Real time Pipeline in kafka
# $History
# 20161009 @MIKE
###########################################################################
kafka_producer='$KAFKA_HOME/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test';
file="$1";
num_line=$(wc -l "$file" | awk '{print $1}');
### Open the file content but keep it open for new incomming messages.###
### Just need to pipe the command that want to read the content of the file##
tail -n $num_line -f "$file" | $kafka_producer &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment