Skip to content

Commit a644951

Browse files
authored
Update StandaloneProcessor.java
1 parent 586f61d commit a644951

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

example-java/src/main/java/com/softwaremill/kmq/example/standalone/StandaloneProcessor.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
import com.softwaremill.kmq.KmqClient;
44
import com.softwaremill.kmq.example.UncaughtExceptionHandling;
55
import org.apache.kafka.clients.consumer.ConsumerRecord;
6+
import org.apache.kafka.clients.CommonClientConfigs;
67
import org.apache.kafka.common.serialization.ByteBufferDeserializer;
8+
import org.apache.kafka.common.config.SslConfigs;
9+
710
import org.slf4j.Logger;
811
import org.slf4j.LoggerFactory;
912

1013
import java.io.IOException;
1114
import java.nio.ByteBuffer;
1215
import java.time.Clock;
1316
import java.util.Map;
17+
import java.util.HashMap;
1418
import java.util.Random;
1519
import java.util.concurrent.ConcurrentHashMap;
1620
import java.util.concurrent.ExecutorService;
@@ -24,6 +28,22 @@ class StandaloneProcessor {
2428

2529
public static void main(String[] args) throws InterruptedException, IOException {
2630
UncaughtExceptionHandling.setup();
31+
32+
/* EXAMPLE with extraConfig : SSL Encryption & SSL Authentication
33+
Map extraConfig = new HashMap();
34+
//configure the following three settings for SSL Encryption
35+
extraConfig.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SSL");
36+
extraConfig.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, "/directory/kafka.client.truststore.jks");
37+
extraConfig.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, "test1234");
38+
39+
// configure the following three settings for SSL Authentication
40+
extraConfig.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, "/directory/kafka.client.keystore.jks");
41+
extraConfig.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, "test1234");
42+
extraConfig.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, "test1234");
43+
44+
KmqClient<ByteBuffer, ByteBuffer> kmqClient = new KmqClient<>(KMQ_CONFIG, KAFKA_CLIENTS,
45+
ByteBufferDeserializer.class, ByteBufferDeserializer.class, 100, extraConfig);
46+
*/
2747

2848
KmqClient<ByteBuffer, ByteBuffer> kmqClient = new KmqClient<>(KMQ_CONFIG, KAFKA_CLIENTS,
2949
ByteBufferDeserializer.class, ByteBufferDeserializer.class, 100);

0 commit comments

Comments
 (0)