sergAccount

Untitled

Aug 8th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.43 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package com.spec.service;
  7.  
  8. import com.spec.serializers.CustomerSerializer;
  9. import java.util.Properties;
  10. import org.apache.kafka.clients.producer.ProducerConfig;
  11.  
  12. /**
  13.  *
  14.  * @author Administrator
  15.  */
  16. public class CustomerKafkaConfig {
  17.     // используется CustomerSerializer
  18.     //
  19.     public static Properties getConfig(){                        
  20.         //
  21.         //String s = ProducerConfig.BOOTSTRAP_SERVERS_CONFIG;  
  22.        
  23.         final Properties properties = new Properties();
  24.         properties.put("bootstrap.servers", "localhost:9092");                
  25.         //properties.put(ProducerConfig.ACKS_CONFIG, "1");        
  26.         //properties.put(ProducerConfig.RETRIES_CONFIG, "1");                
  27.         //properties.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, "1");                        
  28.         //properties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092,192.168.22.12:9088,localhost:7898");                
  29.         properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
  30.         properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG , CustomerSerializer.class.getName());
  31.         //
  32.         return properties;
  33.     }    
  34.    
  35. }
  36.  
Add Comment
Please, Sign In to add comment