Commit b866f0b9 authored by Ina Curdt's avatar Ina Curdt
Browse files

SI-157 Versehentlich auf diesem Branch vorgenommene Änderungen zu US 157,...

SI-157 Versehentlich auf diesem Branch vorgenommene Änderungen zu US 157, müssen dennoch commited werden
parent cf5de027
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);
}
}
# *******************************************************************************
# 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: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjB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VGVzdGVyTGFzdG5hbWVfcndhIn0.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.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYTQwYy0yYj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Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg
services:
authNAuth:
name: authNAuthService
authNAuthService:
ribbon:
listOfServers: http://localhost:8080
cors:
corsEnabled: true
\ No newline at end of file
# *******************************************************************************
# 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
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() {
}
}
......@@ -24,12 +24,46 @@ import java.util.Optional;
@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 @@ public class RabbitMqConfig {
}
@Bean
public MessageChannel messageImportChannel() {
public MessageChannel failureExchange() {
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 messageImportQueue() { return new Queue(queueName); }
public Queue exportQueue() { return new Queue(exportStoerauskunftQueueName); }
@Bean
public Binding binding() { return BindingBuilder.bind(messageImportQueue()).to(exchange()).with(routingKey); }
public Binding exportBinding() { return BindingBuilder.bind(exportQueue()).to(exchange()).with(exportStoerauskunftRoutingKey); }
}
\ No newline at end of file
......@@ -5,6 +5,8 @@ import org.springframework.amqp.core.*;
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 org.springframework.beans.factory.annotation.Autowired;
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 @@ public class JobManager {
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); }
}
......@@ -21,7 +21,7 @@ public class MessageConsumer {
@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);
......
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
/*
*******************************************************************************
* 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;
}
......@@ -22,10 +22,12 @@ spring:
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
......
......@@ -22,9 +22,13 @@ spring:
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:
......
......@@ -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>
......
......@@ -22,9 +22,10 @@ spring:
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
......