Gitlab - Argos ALM by PALO IT

Commit ed3cfb25 authored by Julian Pulido's avatar Julian Pulido

update proto file

parent 0d8b5c9e
package com.cardiff.pocmeasurekafka.out.grpc; package com.cardiff.pocmeasurekafka.out.grpc;
import java.time.Instant;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -25,8 +23,7 @@ public class GrpcAdapter { ...@@ -25,8 +23,7 @@ public class GrpcAdapter {
@Value("${grpc.adapter.port:9099}") @Value("${grpc.adapter.port:9099}")
private int port; private int port;
private final static DateTimeFormatter formatter = DateTimeFormatter.ISO_INSTANT; public String createMeasure(Measure measure) {
public String CreateMeasure(Measure measure) {
ManagedChannel channel = ManagedChannelBuilder.forAddress(host, port) ManagedChannel channel = ManagedChannelBuilder.forAddress(host, port)
.usePlaintext() .usePlaintext()
.build(); .build();
...@@ -37,6 +34,6 @@ public class GrpcAdapter { ...@@ -37,6 +34,6 @@ public class GrpcAdapter {
measure.deviceId()).setValue(measure.value()).setDate(measure.date().toInstant(ZoneOffset.UTC).toString()) measure.deviceId()).setValue(measure.value()).setDate(measure.date().toInstant(ZoneOffset.UTC).toString())
.build()); .build());
channel.isShutdown(); channel.isShutdown();
return measureResponse.getId(); return measureResponse.getDeviceId();
} }
} }
...@@ -4,7 +4,6 @@ import org.slf4j.Logger; ...@@ -4,7 +4,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.cardiff.pocmeasurekafka.in.stream.MeasureConsumer;
import com.cardiff.pocmeasurekafka.model.Measure; import com.cardiff.pocmeasurekafka.model.Measure;
import com.cardiff.pocmeasurekafka.out.grpc.GrpcAdapter; import com.cardiff.pocmeasurekafka.out.grpc.GrpcAdapter;
import com.cardiff.pocmeasurekafka.out.redis.RedisAdapter; import com.cardiff.pocmeasurekafka.out.redis.RedisAdapter;
...@@ -21,7 +20,9 @@ public class MeasureService { ...@@ -21,7 +20,9 @@ public class MeasureService {
public String saveMeasureRedis(Measure measure){ public String saveMeasureRedis(Measure measure){
String deviceIdRedis = redisAdapter.saveMeasureRedis(measure).deviceId(); String deviceIdRedis = redisAdapter.saveMeasureRedis(measure).deviceId();
log.info("catch deviceID response redis {}", deviceIdRedis); log.info("catch deviceID response redis {}", deviceIdRedis);
String deviceIdGrpc = grpcAdapter.CreateMeasure(measure); String deviceIdFromRedis = redisAdapter.getByDeviceId(measure.deviceId()).deviceId();
log.info("catch deviceID getByDeviceId from redis {}", deviceIdFromRedis);
String deviceIdGrpc = grpcAdapter.createMeasure(measure);
log.info("catch deviceID response Grpc {}", deviceIdRedis); log.info("catch deviceID response Grpc {}", deviceIdRedis);
return deviceIdGrpc; return deviceIdGrpc;
} }
......
...@@ -19,11 +19,11 @@ message CreateMeasureRequest { ...@@ -19,11 +19,11 @@ message CreateMeasureRequest {
} }
message CreateMeasureResponse { message CreateMeasureResponse {
string id = 1; string deviceId = 1;
} }
message GetMeasureRequest { message GetMeasureRequest {
string id = 1; string deviceId = 1;
} }
message GetMeasureResponse { message GetMeasureResponse {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment