Repository: qpid-proton Updated Branches: refs/heads/master d48fdb69b -> 703db66ff
PROTON-827: go binding: move example instructions to examples/go/README.md Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/703db66f Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/703db66f Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/703db66f Branch: refs/heads/master Commit: 703db66ff3cdebf302a2be7361f12d2e5bbba50f Parents: d48fdb6 Author: Alan Conway <[email protected]> Authored: Tue May 5 22:27:38 2015 -0400 Committer: Alan Conway <[email protected]> Committed: Tue May 5 22:36:12 2015 -0400 ---------------------------------------------------------------------- examples/go/README.md | 69 +++++++++++++++++++++++++++++++++++++ proton-c/bindings/go/README.md | 39 +-------------------- 2 files changed, 70 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/703db66f/examples/go/README.md ---------------------------------------------------------------------- diff --git a/examples/go/README.md b/examples/go/README.md new file mode 100644 index 0000000..719a3d1 --- /dev/null +++ b/examples/go/README.md @@ -0,0 +1,69 @@ +# Go examples for proton + +The Go support for proton consists of 3 packages: + +- proton: converts AMQP messages and data types to and from Go data types. +- proton/messaging: easy-to-use, concurrent API for messaging clients and servers. +- proton/event: full low-level access to the proton engine. + +Most applications should use the proton/messaging API. proton/event is for +applications that need low-level access to the proton engine. proton/messaging +itself is implemented using proton/event. + +## proton/messaging examples + +- [receive.go](receive.go) receive from many connections concurrently. +- [send.go](send.go) send to many connections concurrently. + +## proton/event examples + +- [broker.go](event/broker.go) simple mini-broker, queues are created automatically. + +## Running the examples + +Proton needs to be installed in a standard place such as `/usr` or `/usr/local`. +(in future the examples will be able to use the local proton build) + +Set your environment: + + export GOPATH=<path-to-proton-checkout>/proton-c/bindings/go + +You can run the examples directly from source with + + go run <program>.go + +This is a little slow (a couple of seconds) as it compiles the program and runs it in one step. +You can compile the program first and then run the executable to avoid the delay: + + go build <program>.go + ./<program> + +All the examples take a `-h` flag to show usage information, see comments in the example +source for more details. + +## Example of running the examples. + +First start the broker: + + go run event/broker.go + +Send messages concurrently to queues "foo" and "bar", 10 messages to each queue: + + go run go/send.go -count 10 localhost:/foo localhost:/bar + +Receive messages concurrently from "foo" and "bar". Note -count 20 for 10 messages each on 2 queues: + + go run go/receive.go -count 20 localhost:/foo localhost:/bar + +The broker and clients use the amqp port on the local host by default, to use a +different address use the `-addr host:port` flag. + +You can mix it up by running the Go clients with the python broker: + + python ../python/broker.py + +Or use the Go broker and the python clients: + + python ../python/simple_send.py + python ../python/simple_recv.py`. + http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/703db66f/proton-c/bindings/go/README.md ---------------------------------------------------------------------- diff --git a/proton-c/bindings/go/README.md b/proton-c/bindings/go/README.md index cefcae7..a70aa2c 100644 --- a/proton-c/bindings/go/README.md +++ b/proton-c/bindings/go/README.md @@ -41,44 +41,7 @@ reactor. It's unclear if the reactor is important for go. The messaging package is just starting. The examples work but anything else might not. -### Examples - -messaging API: - -- [receive.go](../../../examples/go/receive.go) receive from many connections concurrently -- [send.go](../../../examples/go/send.go) send to many connections concurrently - -event API: -- [broker.go](../../../examples/go/event/broker.go) simple mini-broker - -The examples work with each other and with the python examples. - -To try them out, start a broker with either of: - - python python/broker.py - go run go/event/broker.go - -The go broker is more informative, the python broker is a strong, silent type. - -Now you can send messages to the broker concurrently (10 to each queue foo and bar): - - go run go/send.go -count 10 localhost:/foo localhost:/bar - -And receive them concurrently (note count 20, 10 each on 2 queues) - - go run go/receive.go -count 20 localhost:/foo localhost:/bar - -You can also try python clients with the go broker. Others should work but that's all I've tried. - -All the example programs have usage messages for more details. - -NOTE: they seem slow to run because `go run` *compiles the program and -all it's libraries then runs it* in one step!! (I'm looking at YOU C++!) - -You can build an executable first and run that: - - go build go/send.go - ./send ... +There are working [examples](../../../examples/go) of a broker, sender and receiver. ## The event driven API --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
