We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public class SimpleProducer { private final static Logger logger = LoggerFactory.getLogger(SimpleProducer.class); private final static String TOPIC_NAME = "test"; private final static String BOOTSTRAP_SERVERS = "my-kafka:9092"; public static void main(String[] args) { Properties configs = new Properties(); configs.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS); configs.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); configs.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); KafkaProducer<String, String> producer = new KafkaProducer<>(configs); String messageValue = "testMessage"; ProducerRecord<String, String> record = new ProducerRecord<>(TOPIC_NAME, messageValue); producer.send(record); producer.flush(); producer.close(); } }
// key 설정 레코드 ProducerRecord<String, String> record = new ProducerRecord<>(TOPIC_NAME, "Pangyo", "23"); // partition 지정 레코드 ProducerRecord<String, String> record = new ProducerRecord<>(TOPIC_NAME, 0, "Pangyo", "23");
ProducerRecord<String, String> record = new ProducerRecord<>(TOPIC_NAME, messageValue); RecordMetadata metadata = producer.send(record).get(); logger.info(metadata.toString());
The text was updated successfully, but these errors were encountered:
No branches or pull requests
카프카 클라이언트
프로듀서 필수 옵션
프로듀서 선택 옵션
메시지 키를 가진 데이터 전송 프로듀서
커스텀 파티셔너
브로커 정상 전송 여부 확인 프로듀서
The text was updated successfully, but these errors were encountered: