Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Demo flights and demo tickets #122

Open
wants to merge 5 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
49 changes: 48 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
<logback-classic.version>1.1.7</logback-classic.version>
<maven-assembly-plugin>2.5</maven-assembly-plugin>
<scalastyle-maven-plugin>0.8.0</scalastyle-maven-plugin>
<kafka.version>0.10.1.1</kafka.version>
<kafka.version>0.10.0.1</kafka.version>
<zookeeper.version>3.4.6</zookeeper.version>
<typesafe.config.version>1.3.0</typesafe.config.version>
<akka.version>2.4.17</akka.version>
<akka.http.experimental.version>2.4.11</akka.http.experimental.version>
Expand All @@ -43,6 +44,7 @@
<scala-maven.tests.plugin.version>2.19.1</scala-maven.tests.plugin.version>
<scala-maven.plugin.version>3.2.2</scala-maven.plugin.version>
<dropwizard.metrics.version>3.2.2</dropwizard.metrics.version>
<csv.parser.version>0.1.19</csv.parser.version>
</properties>

<developers>
Expand Down Expand Up @@ -112,6 +114,36 @@
</repositories>

<dependencies>
<dependency>
<groupId>com.nrinaudo</groupId>
<artifactId>kantan.csv_${scala.binary.version}</artifactId>
<version>${csv.parser.version}</version>
</dependency>
<dependency>
<groupId>com.nrinaudo</groupId>
<artifactId>kantan.csv-java8_${scala.binary.version}</artifactId>
<version>${csv.parser.version}</version>
</dependency>
<dependency>
<groupId>com.nrinaudo</groupId>
<artifactId>kantan.csv-scalaz_${scala.binary.version}</artifactId>
<version>${csv.parser.version}</version>
</dependency>
<dependency>
<groupId>com.nrinaudo</groupId>
<artifactId>kantan.csv-cats_${scala.binary.version}</artifactId>
<version>${csv.parser.version}</version>
</dependency>
<dependency>
<groupId>com.nrinaudo</groupId>
<artifactId>kantan.csv-generic_${scala.binary.version}</artifactId>
<version>${csv.parser.version}</version>
</dependency>
<dependency>
<groupId>com.nrinaudo</groupId>
<artifactId>kantan.csv-joda-time_${scala.binary.version}</artifactId>
<version>${csv.parser.version}</version>
</dependency>
<dependency>
<groupId>org.json4s</groupId>
<artifactId>json4s-native_${scala.binary.version}</artifactId>
Expand All @@ -127,6 +159,17 @@
<artifactId>logback-classic</artifactId>
<version>${logback-classic.version}</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_${scala.binary.version}</artifactId>
Expand All @@ -136,6 +179,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
48 changes: 48 additions & 0 deletions scripts/demo-flights
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
create kafka-config

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this file make sense to be pushed to the repo?? It seems the configurations for your use case, doesn't it?


kafka {
bootstrap.servers="localhost:9092"
key.serializer = "org.apache.kafka.common.serialization.StringSerializer"
value.serializer = "org.apache.kafka.common.serialization.StringSerializer"
}


create twirl-template

@import com.stratio.khermes.helpers.faker.Faker
@(faker: Faker)
@defining(faker.Flights.flight) { case (randomFlight) => {
"Year": "@(randomFlight.Year)",
"UniqueCarrier": "@(randomFlight.UniqueCarrier)",
"FlightNum": "@(randomFlight.FlightNum)",
"AirTime": "@(randomFlight.AirTime)",
"ArrDelay": "@(randomFlight.ArrDelay)",
"DepDelay": "@(randomFlight.DepDelay)",
"Origin": "@(randomFlight.Origin)",
"Dest": "@(randomFlight.Dest)",
"Distance": "@(randomFlight.Distance)",
"Cancelled": "@(randomFlight.Cancelled)",
"CancellationCode": "@(randomFlight.CancellationCode)",
"Diverted": "@(randomFlight.Diverted)",
"CarrierDelay": "@(randomFlight.CarrierDelay)",
"WeatherDelay": "@(randomFlight.WeatherDelay)",
"NASDelay": "@(randomFlight.NASDelay)",
"SecurityDelay": "@(randomFlight.SecurityDelay)",
"LateAircraftDelay": "@(randomFlight.LateAircraftDelay)"
}}


create generator-config

khermes {
templates-path = "/tmp/khermes/templates"
topic = "khermes"
template-name = "khermestemplate"
i18n = "ALL-SMALL"

timeout-rules {
number-of-events: 100
duration: 10 seconds
}

}
43 changes: 43 additions & 0 deletions scripts/demo-tickets
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
create kafka-config

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same as above comment


kafka {
bootstrap.servers="localhost:9092"
key.serializer = "org.apache.kafka.common.serialization.StringSerializer"
value.serializer = "org.apache.kafka.common.serialization.StringSerializer"
}


create twirl-template

@import scala.util.Random
@import com.stratio.khermes.helpers.faker.generators.Positive
@import com.stratio.khermes.helpers.faker.Faker
@(faker: Faker)
@defining(faker.Tickets.generateTicket) { case (randomTicket) => {
"id": "@(randomTicket.id)",
"idSale": "@(randomTicket.idSale)",
"dateFlat": @(randomTicket.dateFlat),
"date": "@(randomTicket.date)",
"cashier": "@(randomTicket.cashier)",
"clientId": "@(randomTicket.clientId)",
"clientName": "@(randomTicket.clientName)",
"storeId": "@(randomTicket.storeId)",
"totalSale": @(randomTicket.totalSale),
"lines": [@(randomTicket.lines)],
"pays": [@(randomTicket.pays)]
}}


create generator-config

khermes {
templates-path = "/tmp/khermes/templates"
topic = "tickets"
template-name = "khermestemplate"
i18n = "ALL"

timeout-rules {
number-of-events: 1
duration: 5 seconds
}
}
2 changes: 1 addition & 1 deletion scripts/node
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java -jar -Dkhermes.client=false -Dkhermes.ws=false -Dakka.remote.netty.tcp.port=2554 -Dakka.cluster.seed-nodes.0=akka.tcp://khermes@localhost:2552 -Dmetrics.graphite.name="khermes-node1" ../target/khermes-0.2.0-SNAPSHOT-allinone.jar
java -jar -Xmx2048m -Dkhermes.client=false -Dkhermes.ws=false -Dakka.remote.netty.tcp.port=2554 -Dakka.cluster.seed-nodes.0=akka.tcp://khermes@localhost:2552 -Dmetrics.graphite.name="khermes-node1" ../target/khermes-0.2.0-SNAPSHOT-allinone.jar
2 changes: 1 addition & 1 deletion scripts/seed
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java -jar -Dkhermes.ws=true -Dakka.remote.netty.tcp.port=2552 -Dakka.remote.netty.tcp.hostname=localhost -Dakka.cluster.seed-nodes.0=akka.tcp://khermes@localhost:2552 -Dmetrics.graphite.name="khermes-seed" ../target/khermes-0.2.0-SNAPSHOT-allinone.jar
java -jar -Xmx2048m -Dkhermes.ws=true -Dakka.remote.netty.tcp.port=2552 -Dakka.remote.netty.tcp.hostname=localhost -Dakka.cluster.seed-nodes.0=akka.tcp://khermes@localhost:2552 -Dmetrics.graphite.name="khermes-seed" ../target/khermes-0.2.0-SNAPSHOT-allinone.jar
10 changes: 5 additions & 5 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
khermes {
ws {
hostname = 0.0.0.0
port = 8080
port = 8082
}
templates-path = "/tmp/khermes/templates"
client = false
Expand Down Expand Up @@ -34,9 +34,9 @@ akka {
}

zookeeper {
connection = "localhost:2181"
connectionTimeout = 15000
sessionTimeout = 60000
connection = "127.0.0.1:2181"
connectionTimeout = 60000
sessionTimeout = 180000
retryAttempts = 50
retryInterval = 10000
}
Expand All @@ -53,4 +53,4 @@ metrics {
host = 0.0.0.0
port = 2003
}
}
}
Loading