3
3
import com .softwaremill .kmq .KmqClient ;
4
4
import com .softwaremill .kmq .example .UncaughtExceptionHandling ;
5
5
import org .apache .kafka .clients .consumer .ConsumerRecord ;
6
+ import org .apache .kafka .clients .CommonClientConfigs ;
6
7
import org .apache .kafka .common .serialization .ByteBufferDeserializer ;
8
+ import org .apache .kafka .common .config .SslConfigs ;
9
+
7
10
import org .slf4j .Logger ;
8
11
import org .slf4j .LoggerFactory ;
9
12
10
13
import java .io .IOException ;
11
14
import java .nio .ByteBuffer ;
12
15
import java .time .Clock ;
13
16
import java .util .Map ;
17
+ import java .util .HashMap ;
14
18
import java .util .Random ;
15
19
import java .util .concurrent .ConcurrentHashMap ;
16
20
import java .util .concurrent .ExecutorService ;
@@ -24,6 +28,22 @@ class StandaloneProcessor {
24
28
25
29
public static void main (String [] args ) throws InterruptedException , IOException {
26
30
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
+ */
27
47
28
48
KmqClient <ByteBuffer , ByteBuffer > kmqClient = new KmqClient <>(KMQ_CONFIG , KAFKA_CLIENTS ,
29
49
ByteBufferDeserializer .class , ByteBufferDeserializer .class , 100 );
0 commit comments