This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <source> | |
| @type tail | |
| format json | |
| path /var/log/jenkins/jenkins.log | |
| pos_file /var/lib/google-fluentd/pos/jenkins-log.pos | |
| tag jenkins-log | |
| read_from_head true | |
| </source> | |
| <match jenkins-log> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @KafkaHandler | |
| public void consume(@Payload String input,@Header(KafkaHeaders.OFFSET) String offset){ | |
| log.info(" offset: " + offset + "Incoming info: "+student); | |
| try { | |
| ObjectMapper mapper = new ObjectMapper(); | |
| Student student = mapper.readValue(input, Student.class); | |
| log.info("Student :"+json); | |
| } catch (JsonProcessingException e) { | |
| e.printStackTrace(); | |
| log.error(e.getMessage()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Log4j2 | |
| @Service | |
| @KafkaListener(id = "temp-id",topics = "#{'${spring.kafka.incoming.topic}'.split(',')}") | |
| public class Consumer { | |
| @KafkaHandler | |
| public void consume(Student student,@Header(KafkaHeaders.OFFSET) String offset) | |
| log.info("offset:" + offset + "Incoming info: "+student); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Configuration | |
| public class Producer { | |
| @Autowired | |
| private KafkaTemplate<String, Student> kafkaTemplate; | |
| public String pushIntoKafka(String topic, Student student) { | |
| try { | |
| kafkaTemplate.send(topic, student); | |
| return "success"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Configuration | |
| public class Producer { | |
| @Autowired | |
| private KafkaTemplate<String, Student> kafkaTemplate; | |
| public String pushIntoKafka(String topic, Student student) { | |
| try { | |
| kafkaTemplate.send(topic, student); | |
| return "success"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import hashlib as hasher | |
| import datetime as date | |
| # Define what a Snakecoin block is | |
| class Block: | |
| def __init__(self, index, timestamp, data, previous_hash): | |
| self.index = index | |
| self.timestamp = timestamp | |
| self.data = data | |
| self.previous_hash = previous_hash |