Run scripts under kafka/bin via Go code.
Is there a way of running the Kafka-topics.sh command from apache Kafka/bin directory via go lang code?
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
@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?
Hi @jliunyu ,
I am planing to do a similar thing. A service where:
- 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
principalscan 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
Seems like this library supports it. https://github.com/segmentio/kafka-go/issues/729
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 :)
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
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.
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