-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
137 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
 | ||
|
||
Usage | ||
|
||
To send a message confused with "farfallino" alphabet | ||
% curl -d "Salvo" http://localhost:9090 | ||
|
||
mvn archetype:generate \ | ||
-DarchetypeGroupId=org.apache.kafka \ | ||
-DarchetypeArtifactId=streams-quickstart-java \ | ||
-DarchetypeVersion=3.9.0 \ | ||
-DgroupId=streams.examples \ | ||
-DartifactId=kafka-streams.examples \ | ||
-Dversion=0.1 \ | ||
-Dpackage=tap | ||
To send a message confused with "hacker" alphabet | ||
% curl -d "Salvo" http://localhost:9091 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,32 @@ | ||
input { | ||
http { | ||
id => "tap_http_in" | ||
id => "farfallino" | ||
port => 9090 | ||
add_field => { "confused_language" => "farfallino" } | ||
} | ||
|
||
http { | ||
id => "hacker" | ||
port => 9091 | ||
add_field => { "confused_language" => "hacker" } | ||
} | ||
} | ||
|
||
filter { | ||
if [http][method] != "POST"{ | ||
drop {} | ||
} | ||
|
||
mutate { | ||
remove_field => ["@timestamp", "@version", "url", "host", "http", "event", "user_agent"] | ||
} | ||
} | ||
|
||
output { | ||
kafka { | ||
codec => json | ||
codec => plain { format => "%{message}" } | ||
topic_id => "babel-input" | ||
bootstrap_servers => "broker:9092" | ||
message_key => "farfallino" | ||
message_key => "%{confused_language}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
81 changes: 0 additions & 81 deletions
81
stream/kafka-streams.examples/src/main/java/tap/WordCount.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package tap; | ||
|
||
public class FarfallinoTranslator { | ||
|
||
// Method to check if a character is a vowel | ||
private static boolean isVowel(char c) { | ||
return "aeiouAEIOU".indexOf(c) != -1; | ||
} | ||
|
||
// Method to translate the given string to Farfallino alphabet | ||
public static String toFarfallino(String input) { | ||
StringBuilder translated = new StringBuilder(); | ||
|
||
// Iterate over each character in the input string | ||
for (int i = 0; i < input.length(); i++) { | ||
char c = input.charAt(i); | ||
|
||
// If the character is a vowel, apply Farfallino transformation | ||
if (isVowel(c)) { | ||
translated.append(c); // Add the original vowel | ||
translated.append('f'); // Add 'f' | ||
translated.append(c); // Add the same vowel again | ||
} else { | ||
translated.append(c); // Add the consonant unchanged | ||
} | ||
} | ||
|
||
return translated.toString(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package tap; | ||
|
||
public class HackerLanguageTranslator { | ||
|
||
// Method to translate a character to its Hacker Language equivalent | ||
private static char toHackerChar(char c) { | ||
switch (Character.toLowerCase(c)) { | ||
case 'a': return '4'; | ||
case 'e': return '3'; | ||
case 'i': return '1'; | ||
case 'o': return '0'; | ||
case 't': return '7'; | ||
default: return c; // If not a vowel or "t", keep the character unchanged | ||
} | ||
} | ||
|
||
// Method to translate the given string to Hacker Language | ||
public static String toHackerLanguage(String input) { | ||
StringBuilder translated = new StringBuilder(); | ||
|
||
// Iterate over each character in the input string | ||
for (int i = 0; i < input.length(); i++) { | ||
char c = input.charAt(i); | ||
translated.append(toHackerChar(c)); // Translate each character | ||
} | ||
|
||
return translated.toString(); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.