elsagong commented on issue #998:
URL: 
https://github.com/apache/pulsar-client-go/issues/998#issuecomment-1588489512

   Hi, I pasted demo as below, please check
   
   
   ```go
   package main
   
   
   import (
        "fmt"
        "log"
        "time"
   
   
        "github.com/apache/pulsar/pulsar-client-go/pulsar"
   )
   
   
   func main() {
        // Pulsar服务的URL
        pulsarURL := "pulsar://localhost:6650"
   
   
        // 创建Pulsar客户端
        client, err := pulsar.NewClient(pulsar.ClientOptions{
                URL: pulsarURL,
        })
        if err != nil {
                log.Fatal(err)
        }
   
   
        defer client.Close()
   
   
        // 创建Pulsar生产者
        producer, err := client.CreateProducer(pulsar.ProducerOptions{
                Topic: "my-topic",
        })
        if err != nil {
                log.Fatal(err)
        }
   
   
        defer producer.Close()
   
   
        // 发布消息
        msg := &pulsar.ProducerMessage{
                Payload: []byte("Hello, Pulsar!"),
        }
   
   
        _, err = producer.Send(msg)
        if err != nil {
                log.Fatal(err)
        }
   
   
        // 创建Pulsar消费者
        consumer, err := client.Subscribe(pulsar.ConsumerOptions{
                Topic:            "my-topic",
                SubscriptionName: "my-subscription",
                Type:            
 pulsar.Exclusive,
        })
        if err != nil {
                log.Fatal(err)
        }
   
   
        defer consumer.Close()
   
   
        // 接收和处理消息
        for {
                msg, err := consumer.Receive()
                if err != nil {
                        log.Fatal(err)
                }
   
   
                fmt.Printf("Received message: %s\n", string(msg.Payload()))
   
   
                consumer.Ack(msg)
        }
   
   
        // 停止Pulsar消费者
        consumer.Close()
   }
   
   
   
   ```
   
   
   
   
   
   
   
    
   
   
   
   
   ------------------ 原始邮件 ------------------
   发件人:                                                                         
                                               "apache/pulsar-client-go"        
                                                                            
***@***.***>;
   发送时间: 2023年6月12日(星期一) 晚上10:00
   ***@***.***>;
   ***@***.******@***.***>;
   主题: Re: [apache/pulsar-client-go] Error of clang-14: error: linker 
command failed with exit code 1 (use -v to see invocation) in macOS (Issue #998)
   
   
   
   
   
    
   Which demo did you run? Can you provide the details of reproduce steps?
    
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   You are receiving this because you authored the thread.Message ID: 
***@***.***>


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to