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
f811754c
Commit
f811754c
authored
Aug 14, 2023
by
Andres Isaac Garcia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable saving in MongoDB
parent
5554c333
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
src/main/java/com/cardif/pocmeasurerest/infra/controller/MeasureController.java
...if/pocmeasurerest/infra/controller/MeasureController.java
+4
-0
src/main/java/com/cardif/pocmeasurerest/infra/repository/MeasureRepositoryImpl.java
...ocmeasurerest/infra/repository/MeasureRepositoryImpl.java
+5
-5
src/main/resources/application.properties
src/main/resources/application.properties
+6
-6
No files found.
src/main/java/com/cardif/pocmeasurerest/infra/controller/MeasureController.java
View file @
f811754c
...
...
@@ -7,9 +7,12 @@ import org.springframework.web.bind.annotation.*;
import
java.util.Optional
;
import
lombok.extern.slf4j.Slf4j
;
@RestController
@CrossOrigin
(
"*"
)
@RequestMapping
(
value
=
"/measure"
)
@Slf4j
public
class
MeasureController
{
private
final
MeasureService
measureService
;
...
...
@@ -20,6 +23,7 @@ public class MeasureController {
@PostMapping
public
Measure
save
(
@RequestBody
Measure
measure
)
{
log
.
info
(
"Create Measure by Rest"
);
return
measureService
.
save
(
measure
);
}
...
...
src/main/java/com/cardif/pocmeasurerest/infra/repository/MeasureRepositoryImpl.java
View file @
f811754c
...
...
@@ -29,11 +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"
,
entity
);
log
.
info
(
"Publish Message Kafka: {}"
,
entity
);
return
new
Measure
(
entity
.
getDeviceId
(),
entity
.
getValue
(),
entity
.
getDate
());
MeasureEntity
entitySaved
=
jpaMeasureRepository
.
save
(
entity
);
streamBridge
.
send
(
"measureProducer"
,
entity
Saved
);
log
.
info
(
"Publish Message Kafka: {}"
,
entity
Saved
);
return
new
Measure
(
entity
Saved
.
getDeviceId
(),
entitySaved
.
getValue
(),
entity
Saved
.
getDate
());
}
@Override
...
...
src/main/resources/application.properties
View file @
f811754c
...
...
@@ -30,11 +30,11 @@ spring.cloud.function.definition=measureConsumer
spring.cloud.stream.bindings.measureProducer.destination
=
measure
# MONGODB
spring.data.mongodb.authentication-database
=
admin
spring.data.mongodb.database
=
ibmclouddb
spring.data.mongodb.host
=
56e4dce3-cd7e-481e-a150-d52b47dadebb-0.blijtlfd05jdimoomdig.databases.appdomain.cloud
spring.data.mongodb.password
=
82c4923123d85e6ced7d7c82ae8a451c65fbdd2607bd21963847479e6fdb3190
spring.data.mongodb.port
=
30301
#
spring.data.mongodb.authentication-database=admin
#
spring.data.mongodb.database=ibmclouddb
#
spring.data.mongodb.host=56e4dce3-cd7e-481e-a150-d52b47dadebb-0.blijtlfd05jdimoomdig.databases.appdomain.cloud
#
spring.data.mongodb.password=82c4923123d85e6ced7d7c82ae8a451c65fbdd2607bd21963847479e6fdb3190
#
spring.data.mongodb.port=30301
spring.data.mongodb.repositories.enabled
=
true # Enable Mongo repositories.
spring.data.mongodb.uri
=
mongodb://ibm_cloud_203a8f7e_6d29_4f2c_987f_3c8b70cc8a2b:82c4923123d85e6ced7d7c82ae8a451c65fbdd2607bd21963847479e6fdb3190@56e4dce3-cd7e-481e-a150-d52b47dadebb-0.blijtlfd05jdimoomdig.databases.appdomain.cloud:30301,56e4dce3-cd7e-481e-a150-d52b47dadebb-1.blijtlfd05jdimoomdig.databases.appdomain.cloud:30301,56e4dce3-cd7e-481e-a150-d52b47dadebb-2.blijtlfd05jdimoomdig.databases.appdomain.cloud:30301/ibmclouddb?authSource=admin&replicaSet=replset
spring.data.mongodb.username
=
ibm_cloud_203a8f7e_6d29_4f2c_987f_3c8b70cc8a2b
\ No newline at end of file
#
spring.data.mongodb.username
=
ibm_cloud_203a8f7e_6d29_4f2c_987f_3c8b70cc8a2b
\ No newline at end of file
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