hrsakai commented on a change in pull request #1838: Pulsar Go client docs
URL: https://github.com/apache/incubator-pulsar/pull/1838#discussion_r193984538
 
 

 ##########
 File path: site/docs/latest/clients/go.md
 ##########
 @@ -0,0 +1,589 @@
+---
+title: The Pulsar Go client
+tags: [client, go, golang]
+---
+
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+The Pulsar Go client can be used to create Pulsar [producers](#producers), 
[consumers](#consumers), and [readers](#readers) in Go (aka Golang).
+
+{% include admonition.html type="info" title="API docs available as well"
+   content="For standard API docs, consult the 
[Godoc](https://godoc.org/github.com/apache/incubator-pulsar/pulsar-client-go/pulsar)."
 %}
+
+## Installation
+
+You can install the `pulsar` library locally using `go get`:
+
+```bash
+$ go get -u github.com/apache/incubator-pulsar/pulsar-client-go/pulsar
+```
+
+Once installed locally, you can import it into your project:
+
+```go
+import "github.com/apache/incubator-pulsar/pulsar-client-go/pulsar"
+```
+
+## Connection URLs {#urls}
+
+{% include explanations/client-url.md %}
+
+## Creating a client
+
+In order to interact with Pulsar, you'll first need a `Client` object. You can 
create a client object using the `NewClient` function, passing in a 
`ClientOptions` object (more on configuration [below](#client-configuration)). 
Here's an example:
+
+
+```go
+import (
+        "log"
+        "runtime"
+
+        "github.com/apache/incubator-pulsar/pulsar-client-go/pulsar"
+)
+
+func main() {
+        cores := runtime.NumCPU()
+
+        clientOpts := pulsar.ClientOptions{
+                URL: "pulsar://localhost:6650",
+                OperationTimeoutSeconds: 5,
+                MessageListenerThreads: cores,
+        }
+
+        client, err := pulsar.NewClient(clientOpts)
+
+        if err != nil {
+                log.Fatalf("Could not instantiate Pulsar client: %v", err)
+        }
+}
+```
+
+### Client configuration
+
+You can configure your Pulsar client using a `ClientOptions` object. Here's an 
example:
+
+```go
 
 Review comment:
   This seems to be the same code as above for me.
   Is this right?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to