Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maven parent, upgrade to k10.1 (kstreams) (updated) #13

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
*.iml
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

# Java template
*.class

# logs
logs
*.log

# Eclipse
.settings/
.project
.classpath

# Intellij
*.ipr
*.iws
.idea/
*.iml
**/.idea/
**/target/

# Package Files
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
67 changes: 63 additions & 4 deletions AvroConsumerExample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>AvroConsumerExample</groupId>
<groupId>com.shapira.examples.kafka.AvroConsumerExample</groupId>
<artifactId>ClickSessionizer</artifactId>
<version>1.0-SNAPSHOT</version>

<parent>
<artifactId>kafka-examples-parent</artifactId>
<groupId>com.shapira.examples.kafka</groupId>
<version>1.0-SNAPSHOT</version>
</parent>


<repositories>
<repository>
Expand All @@ -16,10 +22,18 @@
</repositories>

<properties>
<!--
<kafka.version>0.9.0.0</kafka.version>
<kafka.scala.version>2.11</kafka.scala.version>
<confluent.version>2.0.0</confluent.version>
<avro.version>1.7.7</avro.version>
-->
<kafka.version>0.10.0.1</kafka.version>
<kafka.scala.version>2.10</kafka.scala.version>
<confluent.version>3.2.0</confluent.version>
<avro.version>1.8.1</avro.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -69,6 +83,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<!--
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -78,11 +94,54 @@
</execution>
</executions>
<configuration>
<finalName>uber-${artifactId}-${version}</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.shapira.examples.consumer.avroclicks.AvroClicksSessionizer</mainClass>
</transformer>
</transformers>
<finalName>uber-${project.artifactId}-${project.version}</finalName>
</configuration>
-->
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.avro
</groupId>
<artifactId>
avro-maven-plugin
</artifactId>
<versionRange>
[1.7.7,)
</versionRange>
<goals>
<goal>idl-protocol</goal>
<goal>protocol</goal>
<goal>schema</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>


</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Main-Class: com.shapira.examples.consumer.avroclicks.AvroClicksSessionizer
2 changes: 1 addition & 1 deletion AvroConsumerExample/src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n

log4j.logger.org.apache.kafka=ERROR
log4j.logger.org.apache.kafka=INFO
67 changes: 63 additions & 4 deletions AvroProducerExample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>AvroProducerExample</groupId>
<groupId>com.shapira.examples.kafka.AvroProducerExample</groupId>
<artifactId>ClickstreamGenerator</artifactId>
<version>1.0-SNAPSHOT</version>

<parent>
<artifactId>kafka-examples-parent</artifactId>
<groupId>com.shapira.examples.kafka</groupId>
<version>1.0-SNAPSHOT</version>
</parent>


<repositories>
<repository>
Expand All @@ -27,11 +33,19 @@
</repositories>

<properties>
<!--
<kafka.version>0.8.2.1</kafka.version>
<kafka.scala.version>2.10</kafka.scala.version>
<confluent.version>1.0</confluent.version>
<avro.version>1.7.7</avro.version>
-->
<kafka.version>0.10.0.1</kafka.version>
<kafka.scala.version>2.10</kafka.scala.version>
<confluent.version>3.2.0</confluent.version>
<avro.version>1.8.1</avro.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>


Expand Down Expand Up @@ -80,6 +94,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<!--
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -89,9 +105,52 @@
</execution>
</executions>
<configuration>
<finalName>uber-${artifactId}-${version}</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.shapira.examples.producer.avroclicks.AvroClicksProducer</mainClass>
</transformer>
</transformers>
<finalName>uber-${project.artifactId}-${project.version}</finalName>
</configuration>
-->
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.avro
</groupId>
<artifactId>
avro-maven-plugin
</artifactId>
<versionRange>
[1.7.7,)
</versionRange>
<goals>
<goal>protocol</goal>
<goal>idl-protocol</goal>
<goal>schema</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package com.shapira.examples.producer.avroclicks;

import JavaSessionize.avro.LogLine;
import java.util.Properties;

import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;

import JavaSessionize.avro.LogLine;
import java.util.Properties;
import java.util.Random;
import java.util.concurrent.ExecutionException;

public class AvroClicksProducer {

static boolean verbose = Boolean.getBoolean("log.verbose");

public static void main(String[] args) throws ExecutionException, InterruptedException {
if (args.length != 2) {
System.out.println("Please provide command line arguments: numEvents schemaRegistryUrl");
Expand All @@ -29,20 +33,30 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc
props.put("schema.registry.url", schemaUrl);
// Hard coding topic too.
String topic = "clicks";

System.out.println("Writing topic:" + topic);


Producer<String, LogLine> producer = new KafkaProducer<String, LogLine>(props);

Random rnd = new Random();
// Random rnd = new Random();
for (long nEvents = 0; nEvents < events; nEvents++) {
LogLine event = EventGenerator.getNext();

if (verbose) {
System.out.print("/* >> " + nEvents + " >> */ ");
}

// Using IP as key, so events from same IP will go to same partition
ProducerRecord<String, LogLine> record = new ProducerRecord<String, LogLine>(topic, event.getIp().toString(), event);
producer.send(record).get();


if (verbose) {
System.out.println(event.toString());
}

}
producer.close();

}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Main-Class: com.shapira.examples.producer.avroclicks.AvroClicksProducer
21 changes: 21 additions & 0 deletions AvroProducerExample/src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
log4j.rootLogger=stdout, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n

log4j.logger.org.apache.kafka=INFO
14 changes: 11 additions & 3 deletions FancyMovingAvg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>ConsumerExample</groupId>
<groupId>com.shapira.examples.kafka.ConsumerExample</groupId>
<artifactId>FancyMovingAvg</artifactId>
<version>1.0-SNAPSHOT</version>

<parent>
<artifactId>kafka-examples-parent</artifactId>
<groupId>com.shapira.examples.kafka</groupId>
<version>1.0-SNAPSHOT</version>
</parent>



<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
Expand Down Expand Up @@ -34,4 +42,4 @@
</build>


</project>
</project>
Loading