Gitlab - Argos ALM by PALO IT

Commit 5554c333 authored by Andres Isaac Garcia's avatar Andres Isaac Garcia

Only send message to Kafka

parent fad81d96
...@@ -9,7 +9,10 @@ import org.springframework.stereotype.Repository; ...@@ -9,7 +9,10 @@ import org.springframework.stereotype.Repository;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Optional; import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
@Repository @Repository
@Slf4j
public class MeasureRepositoryImpl implements MeasureRepository { public class MeasureRepositoryImpl implements MeasureRepository {
private final JpaMeasureRepository jpaMeasureRepository; private final JpaMeasureRepository jpaMeasureRepository;
...@@ -26,10 +29,11 @@ public class MeasureRepositoryImpl implements MeasureRepository { ...@@ -26,10 +29,11 @@ public class MeasureRepositoryImpl implements MeasureRepository {
entity.setDate(LocalDateTime.now()); entity.setDate(LocalDateTime.now());
entity.setDeviceId(measure.deviceId()); entity.setDeviceId(measure.deviceId());
entity.setValue(measure.value()); entity.setValue(measure.value());
MeasureEntity entitySaved = jpaMeasureRepository.save(entity); //MeasureEntity entitySaved = jpaMeasureRepository.save(entity);
streamBridge.send("measureProducer", entitySaved); streamBridge.send("measureProducer", entity);
return new Measure(entitySaved.getDeviceId(), entitySaved.getValue(), log.info("Publish Message Kafka: {}", entity);
entitySaved.getDate()); return new Measure(entity.getDeviceId(), entity.getValue(),
entity.getDate());
} }
@Override @Override
......
...@@ -5,7 +5,10 @@ import org.springframework.data.mongodb.core.mapping.Document; ...@@ -5,7 +5,10 @@ import org.springframework.data.mongodb.core.mapping.Document;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import lombok.ToString;
@Document(collection = "measure") @Document(collection = "measure")
@ToString
public class MeasureEntity { public class MeasureEntity {
@Id @Id
......
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