This package enables easy construction of distributed Go application.
Applicatioin processes communicate through standard Go channels. The
package also provides simple access to exported remote methods (RPC).

1. Send "Hello" from one process to another.
     Sending side:
     outch, err := mbxchan.MakeClientChan("mybox")
     outch <- []byte("Hello")

     Receiving side:
     inch, err := mbxchan.MakeServerChan("mybox", "HTTP")
     body, ok <- inch
     fmt.Printf("%s\n", string(body))

2. Synchronous RPC call to remote method by name "Mul"

     type MulStruct struct { A, B int }

     Client side:
     rpc := mbxchan.OpenRpcConn("Mul")
     args := MulStruct{3, 4}
     reply := new(int)
     err := rpc.RpcCall(args, reply)

     Server side:
     err := mbxchan.PublishRpcMethod("Mul", CalcMul) // CalcMul function
is a user function

3. Asynchronous RPC call to remote method by name "Mul". Asynchronous call
returns pointer to structure:
     type rpcCall struct {
         Reply interface{}
         Error error
         Done chan rpcCall

     Client side:
     rpc := mbxchan.OpenRpcConn("Mul")
     args := MulStruct{6, 7}
     reply := new(int)
     mulCall := rpc.RpcGo(args, reply)
     replyCall := <-mulCall.Done

The package could be found on: http://bitbucket.org/levarnon/mbx
See also 'mbxchan' link in http://code.google.com/p/go-wiki/wiki/Projects

Comments are welcome

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
postedJul 2, '14 at 10:59a
activeJul 2, '14 at 10:59a

1 user in discussion

Lev Arnon: 1 post



site design / logo © 2023 Grokbase