Skip to content
Snippets Groups Projects
Commit 34c9f252 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-94 add pluto-grpc api to goofy

parent a0745355
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,22 @@ ...@@ -39,6 +39,22 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId> <artifactId>spring-boot-starter-hateoas</artifactId>
</dependency> </dependency>
<dependency>
<groupId>net.devh</groupId>
<artifactId>grpc-client-spring-boot-starter</artifactId>
</dependency>
<!-- own projects -->
<dependency>
<groupId>de.itvsh.ozg.pluto</groupId>
<artifactId>pluto-interface</artifactId>
</dependency>
<!-- tools -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</dependency>
<!-- Dev --> <!-- Dev -->
<dependency> <dependency>
...@@ -77,7 +93,38 @@ ...@@ -77,7 +93,38 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<!-- other annotation processors -->
</annotationProcessorPaths>
<showWarnings>true</showWarnings>
<compilerArgs>
<compilerArg>
-Amapstruct.defaultComponentModel=spring
</compilerArg>
<compilerArg>
-Amapstruct.unmappedTargetPolicy=ERROR
</compilerArg>
</compilerArgs>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
...@@ -91,7 +138,6 @@ ...@@ -91,7 +138,6 @@
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
...@@ -156,7 +202,6 @@ ...@@ -156,7 +202,6 @@
<groupId>pl.project13.maven</groupId> <groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId> <artifactId>git-commit-id-plugin</artifactId>
<configuration> <configuration>
<verbose>true</verbose>
<offline>true</offline> <offline>true</offline>
</configuration> </configuration>
<executions> <executions>
...@@ -169,14 +214,6 @@ ...@@ -169,14 +214,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>14</source>
<target>14</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
package de.itvsh.goofy.vorgang;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import de.itvsh.ozg.pluto.vorgang.PlutoVorgangHeader;
@Mapper
public interface VorgangMapper {
@Mapping(target = "initialDate", source = "createdAt")
Vorgang toVorgang(PlutoVorgangHeader vorgangHeader);
}
package de.itvsh.goofy.vorgang;
import java.util.stream.Stream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import de.itvsh.ozg.pluto.vorgang.FindVorgangRequest;
import de.itvsh.ozg.pluto.vorgang.VorgangServiceGrpc.VorgangServiceBlockingStub;
import net.devh.boot.grpc.client.inject.GrpcClient;
@Service
class VorgangRemoteService {
@GrpcClient("pluto")
private VorgangServiceBlockingStub vorgangServiceStub;
@Autowired
private VorgangMapper vorgangMapper;
public Stream<Vorgang> findVorgang(int limit, int offset) {
return vorgangServiceStub.findVorgang(buildFindVorgangRequest(limit, offset)).getVorgangList().stream()//
.map(vorgangMapper::toVorgang);
}
private FindVorgangRequest buildFindVorgangRequest(int limit ,int offset) {
return FindVorgangRequest.newBuilder().setLimit(limit).setOffset(offset).build();
}
}
package de.itvsh.goofy.vorgang;
import java.util.stream.Stream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
class VorgangService {
@Autowired
private VorgangRemoteService remoteService;
public Stream<Vorgang> findVorgang(int limit, int offset) {
return remoteService.findVorgang(limit, offset);
}
}
...@@ -5,3 +5,10 @@ logging: ...@@ -5,3 +5,10 @@ logging:
goofy: goofy:
production: false production: false
grpc:
client:
pluto:
address: static://127.0.0.1:9090
negotiationType: PLAINTEXT
\ No newline at end of file
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
<java.version>15</java.version> <java.version>15</java.version>
<spring.boot.version>2.4.0</spring.boot.version> <spring.boot.version>2.4.0</spring.boot.version>
<grpc.spring-boot-starter.version>2.10.1.RELEASE</grpc.spring-boot-starter.version>
<mapstruct.version>1.4.1.Final</mapstruct.version>
<!-- plugins --> <!-- plugins -->
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version> <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
...@@ -40,6 +42,23 @@ ...@@ -40,6 +42,23 @@
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<!-- tools -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>net.devh</groupId>
<artifactId>grpc-client-spring-boot-starter</artifactId>
<version>${grpc.spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>de.itvsh.ozg.pluto</groupId>
<artifactId>pluto-interface</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
...@@ -51,6 +70,7 @@ ...@@ -51,6 +70,7 @@
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>${resources.plugin.version}</version> <version>${resources.plugin.version}</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
...@@ -69,11 +89,8 @@ ...@@ -69,11 +89,8 @@
<goals> <goals>
<goal>build-info</goal> <goal>build-info</goal>
</goals> </goals>
<!-- <configuration> <!-- <configuration> <additionalProperties> <jenkins.build.number>${buildnumber}</jenkins.build.number>
<additionalProperties> </additionalProperties> </configuration> -->
<jenkins.build.number>${buildnumber}</jenkins.build.number>
</additionalProperties>
</configuration> -->
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment