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;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -25,8 +23,7 @@ public class GrpcAdapter {
@Value("${grpc.adapter.port:9099}")
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)
.usePlaintext()
.build();
......@@ -37,6 +34,6 @@ public class GrpcAdapter {
measure.deviceId()).setValue(measure.value()).setDate(measure.date().toInstant(ZoneOffset.UTC).toString())
.build());
channel.isShutdown();
return measureResponse.getId();
return measureResponse.getDeviceId();
}
}
......@@ -4,7 +4,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.cardiff.pocmeasurekafka.in.stream.MeasureConsumer;
import com.cardiff.pocmeasurekafka.model.Measure;
import com.cardiff.pocmeasurekafka.out.grpc.GrpcAdapter;
import com.cardiff.pocmeasurekafka.out.redis.RedisAdapter;
......@@ -21,7 +20,9 @@ public class MeasureService {
public String saveMeasureRedis(Measure measure){
String deviceIdRedis = redisAdapter.saveMeasureRedis(measure).deviceId();
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);
return deviceIdGrpc;
}
......
......@@ -19,11 +19,11 @@ message CreateMeasureRequest {
}
message CreateMeasureResponse {
string id = 1;
string deviceId = 1;
}
message GetMeasureRequest {
string id = 1;
string deviceId = 1;
}
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