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
server.port=8082 | |
grpc.server.port=9892 | |
spring.application.name=allocation-service | |
eureka.instance.prefer-ip-address=true | |
eureka.instance.status-page-url-path=/actuator/info | |
eureka.instance.health-check-url-path=/actuator/health | |
eureka.instance.instanceId= ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}} | |
eureka.client.register-with-eureka=true |
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
package demo.allocation.service; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.TimeUnit; | |
import org.springframework.stereotype.Service; |
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
package demo.employee.service; | |
import java.util.ArrayList; | |
import java.util.List; | |
import demo.interfaces.grpc.Employee; | |
import demo.interfaces.grpc.EmployeeServiceGrpc; | |
import io.grpc.stub.StreamObserver; | |
import net.devh.boot.grpc.server.service.GrpcService; |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>demo.allocation.service</groupId> | |
<artifactId>demo-allocation-service</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> |
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
syntax = "proto3"; | |
option java_multiple_files = true; | |
package demo.interfaces.grpc; | |
message Employee { | |
int64 employeeID = 1; | |
string employeeFirstName = 2; | |
string employeeLastName = 3; | |
fixed64 employeeDateOfBirth = 4; | |
float employeeWorkingYears = 5; |
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
syntax = "proto3"; | |
option java_multiple_files = true; | |
package demo.interfaces.grpc; | |
message Allocation { | |
int64 allocationID = 1; | |
int64 employeeID = 2; | |
int64 projectID = 3; | |
fixed64 allocationStartDate = 4; | |
fixed64 allocationEndDate = 5; |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>demo.interface.service</groupId> | |
<artifactId>demo-interface-service</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> |
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
package poc.grpc; | |
import java.io.IOException; | |
import io.grpc.Server; | |
import io.grpc.ServerBuilder; | |
public class GRPCServer { | |
public static void main(String[] args) throws IOException, InterruptedException { | |
Server server = ServerBuilder.forPort(8080).addService(new HelloServiceImpl()).build(); |
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
package poc.grpc.client; | |
import io.grpc.ManagedChannel; | |
import io.grpc.ManagedChannelBuilder; | |
import poc.grpc.proto.HelloRequest; | |
import poc.grpc.proto.HelloResponse; | |
import poc.grpc.proto.HelloServiceGrpc; | |
public class HelloClient { | |
public static void main(String[] args) { |
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
package poc.grpc; | |
import io.grpc.stub.StreamObserver; | |
import poc.grpc.proto.HelloRequest; | |
import poc.grpc.proto.HelloResponse; | |
import poc.grpc.proto.HelloServiceGrpc.HelloServiceImplBase; | |
public class HelloServiceImpl extends HelloServiceImplBase{ | |
@Override |