confluent-kafka-go icon indicating copy to clipboard operation
confluent-kafka-go copied to clipboard

Run scripts under kafka/bin via Go code.

Open Mayuresh-Gharat opened this issue 4 years ago • 7 comments

Is there a way of running the Kafka-topics.sh command from apache Kafka/bin directory via go lang code?

Mayuresh-Gharat avatar Sep 03 '21 00:09 Mayuresh-Gharat

Hi @Mayuresh-Gharat, thanks for asking. This link contains some examples for running command from go lang code: https://stackoverflow.com/questions/6182369/exec-a-shell-command-in-go, you can just replace their command with your own one is good enough.

But our go clients also contains create topic API which is also a good way to try, this is one of the examples: https://github.com/confluentinc/confluent-kafka-go/blob/master/kafka/adminapi_test.go#L52

jliunyu avatar Sep 07 '21 22:09 jliunyu

@Mayuresh-Gharat, I'm really sorry I deleted your comment by mistake.

I found your comment from my email and pasted it here:

Hi Jing Liu,

Thanks a lot for pointing me to this. I was actually looking for an API
that would help me create ACLs (SASL).

Thanks and regards,

Mayuresh

I'm wondering that do you want to create topics with SASL authentication?

jliunyu avatar Mar 05 '22 07:03 jliunyu

Hi @jliunyu ,

I am planing to do a similar thing. A service where:

  1. HTTP client entities request Admin API's (behind an http endpoint) to 1.1 create a new topic and set acl's such that only certain principals can access them 1.2 after creation of such a topic with acl's, the http endpoint will reply to the http client with the created 'Topic name'

Java has API's to create ACL's https://kafka.apache.org/0110/javadoc/org/apache/kafka/clients/admin/KafkaAdminClient.html specifically CreateAclsResult do we have something similar in the golang library?

Thanks, Raj

deshmukhrajvardhan avatar Mar 17 '22 22:03 deshmukhrajvardhan

Seems like this library supports it. https://github.com/segmentio/kafka-go/issues/729

deshmukhrajvardhan avatar Mar 24 '22 19:03 deshmukhrajvardhan

Hi @jliunyu! I too would love to be able to create Kafka topic ACLs using the confluentinc/confluent-kafka-go library. I don't see any evidence that this library supports that particular operation, but I could be missing something. Have a good day :)

laser avatar Mar 30 '22 22:03 laser

1+ Hi @jliunyu, as Raj @deshmukhrajvardhan has already asked, is there anything similar ? Unfortunately, the question is still unanswered, and i don't want to use another Library now.

Thanks

mattk0stka avatar May 20 '22 14:05 mattk0stka

1+ Hi @jliunyu, as Raj @deshmukhrajvardhan has already asked, is there anything similar ? Unfortunately, the question is still unanswered, and i don't want to use another Library now.

Thanks

We don't have anything similar yet, but we are planning for it. We will update once it's ready.

jliunyu avatar May 23 '22 05:05 jliunyu

Closing this as we now the AdminClient supports the operations that are being asked for in this thread, creating acls:

https://github.com/confluentinc/confluent-kafka-go/blob/master/examples/admin_create_acls/admin_create_acls.go

milindl avatar Feb 28 '23 04:02 milindl