Gitlab - Argos ALM by PALO IT

Commit f811754c authored by Andres Isaac Garcia's avatar Andres Isaac Garcia

Enable saving in MongoDB

parent 5554c333
......@@ -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);
}
......
......@@ -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", entitySaved);
log.info("Publish Message Kafka: {}", entitySaved);
return new Measure(entitySaved.getDeviceId(), entitySaved.getValue(),
entitySaved.getDate());
}
@Override
......
......@@ -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
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