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-rest
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-rest
Commits
5554c333
Commit
5554c333
authored
Aug 04, 2023
by
Andres Isaac Garcia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only send message to Kafka
parent
fad81d96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
src/main/java/com/cardif/pocmeasurerest/infra/repository/MeasureRepositoryImpl.java
...ocmeasurerest/infra/repository/MeasureRepositoryImpl.java
+8
-4
src/main/java/com/cardif/pocmeasurerest/infra/repository/entity/MeasureEntity.java
...pocmeasurerest/infra/repository/entity/MeasureEntity.java
+3
-0
No files found.
src/main/java/com/cardif/pocmeasurerest/infra/repository/MeasureRepositoryImpl.java
View file @
5554c333
...
...
@@ -9,7 +9,10 @@ import org.springframework.stereotype.Repository;
import
java.time.LocalDateTime
;
import
java.util.Optional
;
import
lombok.extern.slf4j.Slf4j
;
@Repository
@Slf4j
public
class
MeasureRepositoryImpl
implements
MeasureRepository
{
private
final
JpaMeasureRepository
jpaMeasureRepository
;
...
...
@@ -26,10 +29,11 @@ public class MeasureRepositoryImpl implements MeasureRepository {
entity
.
setDate
(
LocalDateTime
.
now
());
entity
.
setDeviceId
(
measure
.
deviceId
());
entity
.
setValue
(
measure
.
value
());
MeasureEntity
entitySaved
=
jpaMeasureRepository
.
save
(
entity
);
streamBridge
.
send
(
"measureProducer"
,
entitySaved
);
return
new
Measure
(
entitySaved
.
getDeviceId
(),
entitySaved
.
getValue
(),
entitySaved
.
getDate
());
//MeasureEntity entitySaved = jpaMeasureRepository.save(entity);
streamBridge
.
send
(
"measureProducer"
,
entity
);
log
.
info
(
"Publish Message Kafka: {}"
,
entity
);
return
new
Measure
(
entity
.
getDeviceId
(),
entity
.
getValue
(),
entity
.
getDate
());
}
@Override
...
...
src/main/java/com/cardif/pocmeasurerest/infra/repository/entity/MeasureEntity.java
View file @
5554c333
...
...
@@ -5,7 +5,10 @@ import org.springframework.data.mongodb.core.mapping.Document;
import
java.time.LocalDateTime
;
import
lombok.ToString
;
@Document
(
collection
=
"measure"
)
@ToString
public
class
MeasureEntity
{
@Id
...
...
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