show dbs
🙍♂️
This file contains 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
Some Jenkinsfile examples |
This file contains 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
package com.emon; | |
import org.apache.kafka.clients.consumer.ConsumerConfig; | |
import org.apache.kafka.clients.consumer.ConsumerRecord; | |
import org.apache.kafka.clients.consumer.ConsumerRecords; | |
import org.apache.kafka.clients.consumer.KafkaConsumer; | |
import org.apache.kafka.common.errors.WakeupException; | |
import org.apache.kafka.common.serialization.StringDeserializer; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; |
This file contains 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
Properties properties = new Properties(); | |
properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "127.0.0.1:9092"); | |
properties.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); | |
properties.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); | |
properties.setProperty(ConsumerConfig.GROUP_ID_CONFIG, "my-first-application"); | |
properties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); | |
try (KafkaConsumer<String, String> consumer = new KafkaConsumer<>(properties)) { | |
consumer.subscribe(Collections.singleton("first_topic")); |
This file contains 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
// Create Producer Properties | |
Properties properties = new Properties(); | |
properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "127.0.0.1:9092"); | |
properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); | |
properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); | |
// Create Safe Producer | |
properties.setProperty(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, "true"); | |
properties.setProperty(ProducerConfig.ACKS_CONFIG, "all"); | |
properties.setProperty(ProducerConfig.RETRIES_CONFIG, Integer.toString(Integer.MAX_VALUE)); | |
properties.setProperty(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, "5"); |
This file contains 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
Properties properties = new Properties(); | |
properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "127.0.0.1:9092"); | |
properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); | |
properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); | |
try (KafkaProducer<String, String> producer = new KafkaProducer<>(properties)) { | |
ProducerRecord<String, String> record = new ProducerRecord<>("first_topic","hello world"); | |
producer.send(record); | |
producer.flush(); | |
} |
This file contains 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 java.util.regex.Pattern; | |
public class PatternDemo { | |
private static String REGEX = ":"; | |
private static String INPUT = "boo:and:foo"; | |
public static void main(String[] args) { | |
Pattern pattern = Pattern.compile(REGEX); | |
String[] result = pattern.split(INPUT); | |
This file contains 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
@Bean | |
public InfluxDB influxDb() { | |
final String serverUrl = influxDbUrl; | |
final String username = influxDbUser; | |
final String password = influxDbPassword; | |
final InfluxDB influxDb = InfluxDBFactory.connect(serverUrl, username, password); | |
String databaseName = influxDbDatabase; | |
influxDb.setDatabase(databaseName); | |
influxDb.enableBatch(BatchOptions.DEFAULTS.actions(100).flushDuration(1000)); | |
return influxDb; |