-
Notifications
You must be signed in to change notification settings - Fork 2
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
236 changed files
with
24,091 additions
and
9,456 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
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
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,6 @@ | ||
FROM java:8-jre | ||
|
||
ADD ./build/libs/data-processor-0.1.0.jar app.jar | ||
CMD ["java", "-Djava.security.egd=file:/dev/./urandom", "-Xmx2048m", "-jar", "/app.jar"] | ||
|
||
EXPOSE 9000 |
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,22 @@ | ||
plugins { | ||
id 'com.sourcemuse.mongo' version '1.0.6' | ||
} | ||
|
||
dependencies { | ||
compile 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive' | ||
compile 'com.squareup.retrofit2:retrofit:2.4.0' | ||
compile 'com.squareup.retrofit2:converter-gson:2.4.0' | ||
testCompile 'de.flapdoodle.embed:de.flapdoodle.embed.mongo:2.0.3' | ||
testCompile group: 'org.mockito', name: 'mockito-inline', version: '2.15.0' | ||
testImplementation "io.mockk:mockk:1.8.3" | ||
|
||
} | ||
|
||
test { | ||
runWithMongoDb = true | ||
} | ||
|
||
mongo { | ||
port = 'RANDOM' | ||
logging = 'console' | ||
} |
36 changes: 36 additions & 0 deletions
36
data-processor/resource-manifests/data-processor-deployment.yaml
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,36 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: data-processor | ||
spec: | ||
replicas: 1 | ||
minReadySeconds: 15 | ||
strategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
maxUnavailable: 1 | ||
maxSurge: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: data-processor | ||
spec: | ||
containers: | ||
- image: data-processor:1 | ||
imagePullPolicy: Never | ||
name: data-processor | ||
env: | ||
- name: SPRING_RABBITMQ_HOST | ||
value: "rabbitmq" | ||
- name: SPRING_RABBITMQ_PORT | ||
value: "5672" | ||
- name: SPRING_DATA_MONGODB_HOST | ||
value: "dse-mongo-db" | ||
- name: SPRING_DATA_MONGODB_PORT | ||
value: "27017" | ||
- name: VEHICLE_SERVICE_HOST | ||
value: "gateway-service" | ||
- name: VEHICLE_SERVICE_PORT | ||
value: "4000" | ||
ports: | ||
- containerPort: 9000 |
45 changes: 45 additions & 0 deletions
45
data-processor/src/main/kotlin/at/ac/tuwien/dse/ss18/group05/DataProcessorApplication.kt
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,45 @@ | ||
package at.ac.tuwien.dse.ss18.group05 | ||
|
||
import at.ac.tuwien.dse.ss18.group05.service.client.VehicleService | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.boot.SpringApplication | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker | ||
import org.springframework.context.annotation.Bean | ||
import retrofit2.Retrofit | ||
import retrofit2.converter.gson.GsonConverterFactory | ||
|
||
/** | ||
* <h4>About this class</h4> | ||
* | ||
* <p>Description</p> | ||
* | ||
* @author Daniel Fuevesi | ||
* @version 1.0.0 | ||
* @since 1.0.0 | ||
*/ | ||
@SpringBootApplication | ||
@EnableAutoConfiguration | ||
@EnableCircuitBreaker | ||
class DataProcessorApplication { | ||
|
||
companion object { | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
SpringApplication.run(DataProcessorApplication::class.java, *args) | ||
} | ||
} | ||
|
||
@Bean | ||
fun vehicleService( | ||
@Value("\${vehicle.service.host}") host: String, | ||
@Value("\${vehicle.service.port}") port: String | ||
): VehicleService { | ||
val retrofit = Retrofit.Builder() | ||
.baseUrl("http://$host:$port/vehicle/") | ||
.addConverterFactory(GsonConverterFactory.create()) | ||
.build() | ||
return retrofit.create(VehicleService::class.java) | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
data-processor/src/main/kotlin/at/ac/tuwien/dse/ss18/group05/config/RabbitConfig.kt
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,46 @@ | ||
package at.ac.tuwien.dse.ss18.group05.config | ||
|
||
/* ktlint-disable no-wildcard-imports */ | ||
import org.springframework.amqp.core.* | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
/** | ||
* <h4>About this class</h4> | ||
* | ||
* <p>Description</p> | ||
* | ||
* @author Daniel Fuevesi | ||
* @version 1.0.0 | ||
* @since 1.0.0 | ||
*/ | ||
@Configuration | ||
class RabbitConfig { | ||
|
||
private val topicExchangeName = "vehicle-data-exchange-2" | ||
|
||
@Bean | ||
fun vehicleMovementQueue(): Queue { | ||
return Queue("vehicleQueueProcessing", false) | ||
} | ||
|
||
@Bean | ||
fun emsNotificationQueue(): Queue { | ||
return Queue("emsQueueProcessing", false) | ||
} | ||
|
||
@Bean | ||
fun exchange(): TopicExchange { | ||
return TopicExchange(topicExchangeName) | ||
} | ||
|
||
@Bean | ||
fun vehicleBinding(vehicleMovementQueue: Queue, exchange: TopicExchange): Binding { | ||
return BindingBuilder.bind(vehicleMovementQueue).to(exchange).with("vehicle.data.#") | ||
} | ||
|
||
@Bean | ||
fun emsBinding(emsNotificationQueue: Queue, exchange: TopicExchange): Binding { | ||
return BindingBuilder.bind(emsNotificationQueue).to(exchange).with("ems.notification") | ||
} | ||
} |
Oops, something went wrong.