SI-157 Versehentlich auf diesem Branch vorgenommene Änderungen zu US 157, müssen dennoch commited werden
diff --git a/exportToStoerauskunft/src/main/java/org/eclipse/openk/gridfailureinformation/jobs/exportToStoerauskunft/ExportToStoerauskunftApplication.java b/exportToStoerauskunft/src/main/java/org/eclipse/openk/gridfailureinformation/jobs/exportToStoerauskunft/ExportToStoerauskunftApplication.java new file mode 100644 index 0000000..1c83855 --- /dev/null +++ b/exportToStoerauskunft/src/main/java/org/eclipse/openk/gridfailureinformation/jobs/exportToStoerauskunft/ExportToStoerauskunftApplication.java
@@ -0,0 +1,13 @@ +package org.eclipse.openk.gridfailureinformation.jobs.exportToStoerauskunft; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ExportToStoerauskunftApplication { + + public static void main(String[] args) { + SpringApplication.run(ExportToStoerauskunftApplication.class, args); + } + +}
diff --git a/exportToStoerauskunft/src/main/resources/application.yml b/exportToStoerauskunft/src/main/resources/application.yml new file mode 100644 index 0000000..23a0010 --- /dev/null +++ b/exportToStoerauskunft/src/main/resources/application.yml
@@ -0,0 +1,150 @@ +# ******************************************************************************* +# Copyright (c) 2019 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# SPDX-License-Identifier: EPL-2.0 +# ******************************************************************************* +spring: + datasource: + url: jdbc:postgresql://entopticadirx:5432/GridFailureInfoDevServer + username: gfi_service + password: gfi_service + flyway: + enabled: false + rabbitmq: + host: entdockergss + port: 5672 + username: guest + password: guest + exchangename: failureExchange + routing: + export-stoerauskunft-queuename: failureExportStoerauskunftQueue + export-stoerauskunft-routingkey: failureExchange.failureExportStoerauskunftKey + +server: + max-http-header-size: 262144 + +jwt: + tokenHeader: Authorization + useStaticJwt: false + staticJwt: x + +gridFailureInformation: + maxListSize: 2000 + +services: + authNAuth: + name: authNAuthService + +authNAuthService: + ribbon: + listOfServers: http://entopkon:8880 + +feign: + client: + config: + default: + connectTimeout: 60000 + readTimeout: 60000 +cors: + corsEnabled: false + +--- + +spring: + profiles: test + + datasource: + url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 +jpa: + hibernate: + ddl-auto: create + show-sql: true +flyway: + enabled: false + +jwt: + tokenHeader: Authorization + useStaticJwt: true + staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYTQwYy0yYjQyZTNkNjNiOGEiLCJleHAiOjE1Nzg2NTU3OTUsIm5iZiI6MCwiaWF0IjoxNTc4NjU1NDk1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiODYyNjY5NmYtZjFhMi00ZGI1LTkyZWYtZTlhMjQ2Njg1YTU0IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjJmMWIzODE5LWZjNjQtNDEzNC1iNWQxLWY3ZWY4NzU5NDBkNCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsia29uLWFkbWluIiwia29uLXdyaXRlciIsImtvbi1hY2Nlc3MiLCJrb24tcmVhZGVyIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnt9LCJuYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSBUZXN0ZXJMYXN0bmFtZV9yd2EiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJ0ZXN0dXNlcl9yd2EiLCJnaXZlbl9uYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSIsImZhbWlseV9uYW1lIjoiVGVzdGVyTGFzdG5hbWVfcndhIn0.DAYXuv4tKn8RXqO1jyttnD-tF4nShUBQyfe4bKbAiPAyY2x5YbAf3M4eXnLrGqo8-loGKldICC28bL0LaMA3KKkQEOfW5sfpGqoN6212vs89mOklt0TJYc5PMXwFgJ5WC_TKjdwq7-aaDafOEWehV0U1ut3s-94ovNYIEn29nzXm2W1ldoXJEq03F880jlysQ5zlRvGF7eXEEpFfI2URyyNQ2UWh0Ssfq-gOAt2pbF1u6prA5RfvUmZ3v1eu21YLGZtgqPqxb1l6odyH3ip15j_HdgnTeo52ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg + +--- + +spring: + profiles: devserver + +jwt: + tokenHeader: Authorization + useStaticJwt: false + staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYTQwYy0yYjQyZTNkNjNiOGEiLCJleHAiOjE1Nzg2NTU3OTUsIm5iZiI6MCwiaWF0IjoxNTc4NjU1NDk1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiODYyNjY5NmYtZjFhMi00ZGI1LTkyZWYtZTlhMjQ2Njg1YTU0IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjJmMWIzODE5LWZjNjQtNDEzNC1iNWQxLWY3ZWY4NzU5NDBkNCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsia29uLWFkbWluIiwia29uLXdyaXRlciIsImtvbi1hY2Nlc3MiLCJrb24tcmVhZGVyIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnt9LCJuYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSBUZXN0ZXJMYXN0bmFtZV9yd2EiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJ0ZXN0dXNlcl9yd2EiLCJnaXZlbl9uYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSIsImZhbWlseV9uYW1lIjoiVGVzdGVyTGFzdG5hbWVfcndhIn0.DAYXuv4tKn8RXqO1jyttnD-tF4nShUBQyfe4bKbAiPAyY2x5YbAf3M4eXnLrGqo8-loGKldICC28bL0LaMA3KKkQEOfW5sfpGqoN6212vs89mOklt0TJYc5PMXwFgJ5WC_TKjdwq7-aaDafOEWehV0U1ut3s-94ovNYIEn29nzXm2W1ldoXJEq03F880jlysQ5zlRvGF7eXEEpFfI2URyyNQ2UWh0Ssfq-gOAt2pbF1u6prA5RfvUmZ3v1eu21YLGZtgqPqxb1l6odyH3ip15j_HdgnTeo52ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg + +server: + port: 9175 + +cors: + corsEnabled: true + + +--- + +spring: + profiles: devserver-unsecure + +jwt: + tokenHeader: Authorization + useStaticJwt: true + staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYTQwYy0yYjQyZTNkNjNiOGEiLCJleHAiOjE1Nzg2NTU3OTUsIm5iZiI6MCwiaWF0IjoxNTc4NjU1NDk1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiODYyNjY5NmYtZjFhMi00ZGI1LTkyZWYtZTlhMjQ2Njg1YTU0IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjJmMWIzODE5LWZjNjQtNDEzNC1iNWQxLWY3ZWY4NzU5NDBkNCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsia29uLWFkbWluIiwia29uLXdyaXRlciIsImtvbi1hY2Nlc3MiLCJrb24tcmVhZGVyIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnt9LCJuYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSBUZXN0ZXJMYXN0bmFtZV9yd2EiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJ0ZXN0dXNlcl9yd2EiLCJnaXZlbl9uYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSIsImZhbWlseV9uYW1lIjoiVGVzdGVyTGFzdG5hbWVfcndhIn0.DAYXuv4tKn8RXqO1jyttnD-tF4nShUBQyfe4bKbAiPAyY2x5YbAf3M4eXnLrGqo8-loGKldICC28bL0LaMA3KKkQEOfW5sfpGqoN6212vs89mOklt0TJYc5PMXwFgJ5WC_TKjdwq7-aaDafOEWehV0U1ut3s-94ovNYIEn29nzXm2W1ldoXJEq03F880jlysQ5zlRvGF7eXEEpFfI2URyyNQ2UWh0Ssfq-gOAt2pbF1u6prA5RfvUmZ3v1eu21YLGZtgqPqxb1l6odyH3ip15j_HdgnTeo52ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg + +server: + port: 9176 + +cors: + corsEnabled: true + +--- + +spring: + profiles: qserver + datasource: + url: jdbc:postgresql://localhost:5432/GridFailureInfoQaServer + username: gfi_service + password: gfi_service + flyway: + enabled: false + rabbitmq: + host: entdockergss + port: 5672 + username: guest + password: guest + queuename: failureImportQueue + routingkey: failureImportChannel.failureImportKey + exchangename: failureImportChannel + +server: + port: 9175 + max-http-header-size: 262144 + servlet: + session: + tracking-modes: cookie + +jwt: + tokenHeader: Authorization + useStaticJwt: false + staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYTQwYy0yYjQyZTNkNjNiOGEiLCJleHAiOjE1Nzg2NTU3OTUsIm5iZiI6MCwiaWF0IjoxNTc4NjU1NDk1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiODYyNjY5NmYtZjFhMi00ZGI1LTkyZWYtZTlhMjQ2Njg1YTU0IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjJmMWIzODE5LWZjNjQtNDEzNC1iNWQxLWY3ZWY4NzU5NDBkNCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsia29uLWFkbWluIiwia29uLXdyaXRlciIsImtvbi1hY2Nlc3MiLCJrb24tcmVhZGVyIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnt9LCJuYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSBUZXN0ZXJMYXN0bmFtZV9yd2EiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJ0ZXN0dXNlcl9yd2EiLCJnaXZlbl9uYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSIsImZhbWlseV9uYW1lIjoiVGVzdGVyTGFzdG5hbWVfcndhIn0.DAYXuv4tKn8RXqO1jyttnD-tF4nShUBQyfe4bKbAiPAyY2x5YbAf3M4eXnLrGqo8-loGKldICC28bL0LaMA3KKkQEOfW5sfpGqoN6212vs89mOklt0TJYc5PMXwFgJ5WC_TKjdwq7-aaDafOEWehV0U1ut3s-94ovNYIEn29nzXm2W1ldoXJEq03F880jlysQ5zlRvGF7eXEEpFfI2URyyNQ2UWh0Ssfq-gOAt2pbF1u6prA5RfvUmZ3v1eu21YLGZtgqPqxb1l6odyH3ip15j_HdgnTeo52ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg + +services: + authNAuth: + name: authNAuthService + +authNAuthService: + ribbon: + listOfServers: http://localhost:8080 + +cors: + corsEnabled: true \ No newline at end of file
diff --git a/exportToStoerauskunft/src/main/resources/application_localdev.yml b/exportToStoerauskunft/src/main/resources/application_localdev.yml new file mode 100644 index 0000000..3a63ee3 --- /dev/null +++ b/exportToStoerauskunft/src/main/resources/application_localdev.yml
@@ -0,0 +1,73 @@ +# ******************************************************************************* +# Copyright (c) 2019 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# SPDX-License-Identifier: EPL-2.0 +# ******************************************************************************* +spring: + datasource: + url: jdbc:postgresql://entopticadirx:5432/GridFailureInfoDevelop + username: gfi_service + password: gfi_service + flyway: + enabled: false + rabbitmq: + host: entdockergss + port: 5672 + username: guest + password: guest + exchangename: failureExchange + routing: + export-stoerauskunft-queuename: failureExportStoerauskunftQueueLocalDev + export-stoerauskunft-routingkey: failureExchange.failureExportStoerauskunftKeyLocalDev + +eureka: + client: + service-url: + defaulZone: http://localhost:8761/ + instance: + prefer-ip-address: true + +index-channel: + enabled: true + +server: + port: 9175 + max-http-header-size: 262144 + servlet: + session: + tracking-modes: cookie + +gridFailureInformation: + maxListSize: 2000 + +jwt: + tokenHeader: Authorization + useStaticJwt: false + staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYTQwYy0yYjQyZTNkNjNiOGEiLCJleHAiOjE1Nzg2NTU3OTUsIm5iZiI6MCwiaWF0IjoxNTc4NjU1NDk1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiODYyNjY5NmYtZjFhMi00ZGI1LTkyZWYtZTlhMjQ2Njg1YTU0IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjJmMWIzODE5LWZjNjQtNDEzNC1iNWQxLWY3ZWY4NzU5NDBkNCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsia29uLWFkbWluIiwia29uLXdyaXRlciIsImtvbi1hY2Nlc3MiLCJrb24tcmVhZGVyIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnt9LCJuYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSBUZXN0ZXJMYXN0bmFtZV9yd2EiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJ0ZXN0dXNlcl9yd2EiLCJnaXZlbl9uYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSIsImZhbWlseV9uYW1lIjoiVGVzdGVyTGFzdG5hbWVfcndhIn0.DAYXuv4tKn8RXqO1jyttnD-tF4nShUBQyfe4bKbAiPAyY2x5YbAf3M4eXnLrGqo8-loGKldICC28bL0LaMA3KKkQEOfW5sfpGqoN6212vs89mOklt0TJYc5PMXwFgJ5WC_TKjdwq7-aaDafOEWehV0U1ut3s-94ovNYIEn29nzXm2W1ldoXJEq03F880jlysQ5zlRvGF7eXEEpFfI2URyyNQ2UWh0Ssfq-gOAt2pbF1u6prA5RfvUmZ3v1eu21YLGZtgqPqxb1l6odyH3ip15j_HdgnTeo52ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg + +services: + authNAuth: + name: authNAuthService + +authNAuthService: + ribbon: + listOfServers: http://entopkon:8880 + +cors: + corsEnabled: true + +--- + +spring: + profiles: dev-db + datasource: + url: jdbc:postgresql://entopticadirx:5432/GridFailureInfoDevServer + username: gfi_service + password: gfi_service \ No newline at end of file
diff --git a/exportToStoerauskunft/src/test/java/org/eclipse/openk/gridfailureinformation/jobs/exportToStoerauskunft/ExportToStoerauskunftApplicationTests.java b/exportToStoerauskunft/src/test/java/org/eclipse/openk/gridfailureinformation/jobs/exportToStoerauskunft/ExportToStoerauskunftApplicationTests.java new file mode 100644 index 0000000..c59bf26 --- /dev/null +++ b/exportToStoerauskunft/src/test/java/org/eclipse/openk/gridfailureinformation/jobs/exportToStoerauskunft/ExportToStoerauskunftApplicationTests.java
@@ -0,0 +1,13 @@ +package org.eclipse.openk.gridfailureinformation.jobs.exportToStoerauskunft; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ExportToStoerauskunftApplicationTests { + + @Test + void contextLoads() { + } + +}
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/RabbitMqConfig.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/RabbitMqConfig.java index 3a84318..2a077bf 100644 --- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/RabbitMqConfig.java +++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/RabbitMqConfig.java
@@ -24,12 +24,46 @@ @Log4j2 public class RabbitMqConfig { - @Value("${spring.rabbitmq.routingkey}") - public String routingKey; +// @Value("${spring.rabbitmq.routingkey}") +// public String routingKey; +// @Value("${spring.rabbitmq.exchangename}") +// public String exchangeName; +// @Value("${spring.rabbitmq.queuename}") +// public String queueName; + + +// @Autowired +// private org.springframework.amqp.rabbit.core.RabbitTemplate template; +// +// @Bean +// public DirectExchange exchange() { +// return new DirectExchange(exchangeName); +// } +// +// @Bean +// public MessageChannel messageImportChannel() { +// return new DirectChannel(); +// } +// +// @Bean +// public Queue messageImportQueue() { return new Queue(queueName); } +// +// @Bean +// public Binding binding() { return BindingBuilder.bind(messageImportQueue()).to(exchange()).with(routingKey); } + + @Value("${spring.rabbitmq.exchangename}") public String exchangeName; - @Value("${spring.rabbitmq.queuename}") - public String queueName; + + @Value("${spring.rabbitmq.routing.import-routingkey}") + public String importRoutingKey; + @Value("${spring.rabbitmq.routing.import-queuename}") + public String importQueueName; + + @Value("${spring.rabbitmq.routing.export-stoerauskunft-routingkey}") + public String exportStoerauskunftRoutingKey; + @Value("${spring.rabbitmq.routing.export-stoerauskunft-queuename}") + public String exportStoerauskunftQueueName; @Autowired @@ -41,13 +75,23 @@ } @Bean - public MessageChannel messageImportChannel() { + public MessageChannel failureExchange() { return new DirectChannel(); } + + //Individuelle Queues und Binding-keys + //1. Import @Bean - public Queue messageImportQueue() { return new Queue(queueName); } + public Queue importQueue() { return new Queue(importQueueName); } @Bean - public Binding binding() { return BindingBuilder.bind(messageImportQueue()).to(exchange()).with(routingKey); } + public Binding importBinding() { return BindingBuilder.bind(importQueue()).to(exchange()).with(importRoutingKey); } + + //2.Export to Störauskunft + @Bean + public Queue exportQueue() { return new Queue(exportStoerauskunftQueueName); } + + @Bean + public Binding exportBinding() { return BindingBuilder.bind(exportQueue()).to(exchange()).with(exportStoerauskunftRoutingKey); } } \ No newline at end of file
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/jobs/JobManager.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/jobs/JobManager.java index 497c2b3..18720d2 100644 --- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/jobs/JobManager.java +++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/jobs/JobManager.java
@@ -5,6 +5,8 @@ import org.springframework.amqp.support.converter.SimpleMessageConverter; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; import org.springframework.integration.channel.DirectChannel; import org.springframework.messaging.MessageChannel; import org.springframework.scheduling.annotation.EnableScheduling; @@ -17,8 +19,15 @@ import java.nio.charset.Charset; import java.util.Random; -@EnableScheduling -@Component + + +//@Configuration + + +@Profile("!test") +//@EnableScheduling +//@Component +@Configuration @Log4j2 public class JobManager { @@ -58,4 +67,49 @@ log.info("Message sent!"); }*/ + + +// @Value("${spring.rabbitmq.exchangename}") +// public String exchangeName; +// +// @Value("${spring.rabbitmq.routing.import-routingkey}") +// public String importRoutingKey; +// @Value("${spring.rabbitmq.routing.import-queuename}") +// public String importQueueName; +// +// @Value("${spring.rabbitmq.routing.export-stoerauskunft-routingkey}") +// public String exportStoerauskunftRoutingKey; +// @Value("${spring.rabbitmq.routing.export-stoerauskunft-queuename}") +// public String exportStoerauskunftQueueName; +// +// +// @Autowired +// private org.springframework.amqp.rabbit.core.RabbitTemplate template; +// +// @Bean +// public DirectExchange exchange() { +// return new DirectExchange(exchangeName); +// } +// +// @Bean +// public MessageChannel messageImportChannel() { +// return new DirectChannel(); +// } +// +// +// //Individuelle Queues und Binding-keys +// //1. Import +// @Bean +// public Queue importQueue() { return new Queue(importQueueName); } +// +// @Bean +// public Binding importBinding() { return BindingBuilder.bind(importQueue()).to(exchange()).with(importRoutingKey); } +// +// //2.Export to Störauskunft +// @Bean +// public Queue exportQueue() { return new Queue(exportStoerauskunftQueueName); } +// +// @Bean +// public Binding exportBinding() { return BindingBuilder.bind(exportQueue()).to(exchange()).with(exportStoerauskunftRoutingKey); } + }
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/messagebroker/MessageConsumer.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/messagebroker/MessageConsumer.java index fddf4d1..526518c 100644 --- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/messagebroker/MessageConsumer.java +++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/messagebroker/MessageConsumer.java
@@ -21,7 +21,7 @@ @Autowired private ImportDataService importDataService; - @RabbitListener(queues="${spring.rabbitmq.queuename}") + @RabbitListener(queues="${spring.rabbitmq.routing.import-queuename}") public void listenMessage(Message message) { if (Objects.nonNull(message.getMessageProperties().getHeaders().get("metaId"))) { importData(message);
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/messagebroker/MessageProducer.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/messagebroker/MessageProducer.java new file mode 100644 index 0000000..e19f10f --- /dev/null +++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/messagebroker/MessageProducer.java
@@ -0,0 +1,56 @@ +package org.eclipse.openk.gridfailureinformation.messagebroker; + +import org.eclipse.openk.gridfailureinformation.exceptions.InternalServerErrorException; +import org.eclipse.openk.gridfailureinformation.service.ImportDataService; +import org.eclipse.openk.gridfailureinformation.viewmodel.ExportDataDto; +import org.eclipse.openk.gridfailureinformation.viewmodel.ImportDataDto; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.support.converter.SimpleMessageConverter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Profile; +import org.springframework.integration.support.MessageBuilder; +import org.springframework.messaging.MessageChannel; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.Objects; + +@Profile("!test") +@Component +public class MessageProducer { + + @Autowired + private MessageChannel failureExchange; + + @Scheduled(initialDelay = 1000, fixedRate = 5000) + public void exportDataToStoerauskunft (Message message) { + + ExportDataDto exportDataDto = new ExportDataDto(); + //SimpleMessageConverter converter = new SimpleMessageConverter(); + + exportDataDto.setMessageContent("ExportTest"); + exportDataDto.setMetaId("12345"); + exportDataDto.setDescription("Beschreibung der Störung"); + exportDataDto.setSource(""); + + pushFailure(exportDataDto); + + } + + public void pushFailure(ExportDataDto exportDataDto) { + + try { + failureExchange.send(MessageBuilder.withPayload(exportDataDto.getMessageContent()) + .setHeader("metaId", exportDataDto.getMetaId()) + .setHeader("description", exportDataDto.getDescription()) + .setHeader("source", exportDataDto.getSource()) + .build()); + + } catch (Exception e) { + throw new InternalServerErrorException("could.not.push.message"); + } + + } + +} \ No newline at end of file
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/ExportDataDto.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/ExportDataDto.java new file mode 100644 index 0000000..8dcd8f8 --- /dev/null +++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/ExportDataDto.java
@@ -0,0 +1,33 @@ +/* + ******************************************************************************* + * Copyright (c) 2019 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************* + */ +package org.eclipse.openk.gridfailureinformation.viewmodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.UUID; + +@Data +public class ExportDataDto implements Serializable { + @JsonProperty("id") + private UUID uuid; + private String metaId; + private String description; + private String source; + private String messageContent; +} + +
diff --git a/gfsBackendService/src/main/resources/application.yml b/gfsBackendService/src/main/resources/application.yml index 10ee1c4..7469a69 100644 --- a/gfsBackendService/src/main/resources/application.yml +++ b/gfsBackendService/src/main/resources/application.yml
@@ -22,10 +22,12 @@ port: 5672 username: guest password: guest - queuename: failureImportQueue - routingkey: failureImportChannel.failureImportKey - exchangename: failureImportChannel - + exchangename: failureExchange + routing: + import-queuename: failureImportQueue + import-routingkey: failureExchange.failureImportKey + export-stoerauskunft-queuename: failureExportStoerauskunftQueue + export-stoerauskunft-routingkey: failureExchange.failureExportStoerauskunftKey server: max-http-header-size: 262144
diff --git a/gfsBackendService/src/main/resources/application_localdev.yml b/gfsBackendService/src/main/resources/application_localdev.yml index c5eeb4c..6cdaaf3 100644 --- a/gfsBackendService/src/main/resources/application_localdev.yml +++ b/gfsBackendService/src/main/resources/application_localdev.yml
@@ -22,9 +22,13 @@ port: 5672 username: guest password: guest - queuename: failureImportQueueLocalDev - routingkey: failureImportChannelLocalDev.failureImportKeyLocalDev - exchangename: failureImportChannel + exchangename: failureExchange + routing: + import-queuename: failureImportQueueLocalDev + import-routingkey: failureExchange.failureImportKeyLocalDev + export-stoerauskunft-queuename: failureExportStoerauskunftQueueLocalDev + export-stoerauskunft-routingkey: failureExchange.failureExportStoerauskunftKeyLocalDev + server:
diff --git a/testImportGridFailures/pom.xml b/testImportGridFailures/pom.xml index a4b86c4..ea7ee65 100644 --- a/testImportGridFailures/pom.xml +++ b/testImportGridFailures/pom.xml
@@ -38,7 +38,6 @@ <jsonwebtoken.version>0.9.1</jsonwebtoken.version> <openfeign.version>2.2.0.RELEASE</openfeign.version> <keycloak-core.version>3.4.2.Final</keycloak-core.version> - <nexmo.version>5.2.1</nexmo.version> <rabbitmq.version>5.2.0</rabbitmq.version> </properties> @@ -113,9 +112,6 @@ <version>${rabbitmq.version}</version> </dependency> - - - </dependencies> <!--dependencyManagement>
diff --git a/testImportGridFailures/src/main/resources/application.yml b/testImportGridFailures/src/main/resources/application.yml index 5e1b512..b3ef7cf 100644 --- a/testImportGridFailures/src/main/resources/application.yml +++ b/testImportGridFailures/src/main/resources/application.yml
@@ -22,9 +22,10 @@ port: 5672 username: guest password: guest - queuename: failureImportQueue - routingkey: failureImportChannel.failureImportKey - exchangename: failureImportChannel + exchangename: failureExchange + routing: + import-queuename: failureImportQueue + import-routingkey: failureExchange.failureImportKey server: max-http-header-size: 262144
diff --git a/testImportGridFailures/src/main/resources/application_localdev.yml b/testImportGridFailures/src/main/resources/application_localdev.yml index 79cf5d2..15516b1 100644 --- a/testImportGridFailures/src/main/resources/application_localdev.yml +++ b/testImportGridFailures/src/main/resources/application_localdev.yml
@@ -22,9 +22,10 @@ port: 5672 username: guest password: guest - queuename: failureImportQueueLocalDev - routingkey: failureImportChannelLocalDev.failureImportKeyLocalDev - exchangename: failureImportChannel + exchangename: failureExchange + routing: + import-queuename: failureImportQueueLocalDev + import-routingkey: failureExchange.failureImportKeyLocalDev eureka: client: