Gitlab - Argos ALM by PALO IT
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
poc-measure-kafka
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Luis Eduardo Oviedo Granados
poc-measure-kafka
Commits
ed3cfb25
Commit
ed3cfb25
authored
Jul 28, 2023
by
Julian Pulido
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update proto file
parent
0d8b5c9e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
9 deletions
+7
-9
src/main/java/com/cardiff/pocmeasurekafka/out/grpc/GrpcAdapter.java
...ava/com/cardiff/pocmeasurekafka/out/grpc/GrpcAdapter.java
+2
-5
src/main/java/com/cardiff/pocmeasurekafka/service/MeasureService.java
...a/com/cardiff/pocmeasurekafka/service/MeasureService.java
+3
-2
src/main/proto/measure.proto
src/main/proto/measure.proto
+2
-2
No files found.
src/main/java/com/cardiff/pocmeasurekafka/out/grpc/GrpcAdapter.java
View file @
ed3cfb25
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
.
get
Device
Id
();
}
}
src/main/java/com/cardiff/pocmeasurekafka/service/MeasureService.java
View file @
ed3cfb25
...
...
@@ -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
;
}
...
...
src/main/proto/measure.proto
View file @
ed3cfb25
...
...
@@ -19,11 +19,11 @@ message CreateMeasureRequest {
}
message
CreateMeasureResponse
{
string
i
d
=
1
;
string
deviceI
d
=
1
;
}
message
GetMeasureRequest
{
string
i
d
=
1
;
string
deviceI
d
=
1
;
}
message
GetMeasureResponse
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment