Library: “github.com/confluentinc/confluent-kafka-go/kafka”

        topic := "topic_name"

	p, err := kafka.NewProducer(&kafka.ConfigMap{
		"bootstrap.servers": "kafka:9092",
		"enable.idempotence": "true",
		"acks":               "all",
		"queue.buffering.max.kbytes": 102400000,
		"queue.buffering.max.messages": 10000000,
	})
	if err != nil {
		panic(err)
	}
	defer p.Close()
	
	message := &kafka.Message{
        	TopicPartition: kafka.TopicPartition{Topic: &topic, Partition: kafka.PartitionAny},
              	Key:            []byte("some_key"),  // URL jako klíč
              	Value:          []byte("1"),  // Hodnota 1
        }
        err = p.Produce(message, nil)

Leave a Reply

Your email address will not be published. Required fields are marked *