ericwangdka opened a new issue #334:
URL: https://github.com/apache/pulsar-client-go/issues/334
when compile with goland it shows me undefined: NewAuthenticationTLS
,how can i to do with it.
package main
import (
"context"
"fmt"
"github.com/apache/pulsar-client-go/pulsar"
"log"
)
func main() {
client, err := pulsar.NewClient(pulsar.ClientOptions{
URL: "pulsar+ssl://127.0.0.1:6651/",
TLSTrustCertsFilePath:
"E:\\\\my-ca1\\\\my-ca\\\\certs\\\\ca.cert.pem",
Authentication: NewAuthenticationTLS("my-cert.pem",
"my-key.pem"),
})
if err != nil {
log.Fatal(err)
}
defer client.Close()
producer, err := client.CreateProducer(pulsar.ProducerOptions{
Topic: "persistent://alice/alice-namespace/my-topic1",
})
if err != nil {
log.Fatal(err)
}
defer producer.Close()
ctx := context.Background()
for i := 0; i < 10; i++ {
if msgId, err := producer.Send(ctx, &pulsar.ProducerMessage{
Payload: []byte(fmt.Sprintf("hello-%d", i)),
}); err != nil {
log.Fatal(err)
} else {
log.Println("Published message: ", msgId)
}
}
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]