RPC Framework: Apache Etch now supports Go

87 views
Skip to first unread message

Holger Grandy

unread,
Nov 30, 2010, 8:17:02 AM11/30/10
to golan...@googlegroups.com
Hi,

the Apache Etch service communication framework recently integrated a new binding
for Go, which we want to share with you.

Etch is a RPC-like service framework. You write service descriptions, e.g.:

service HelloWorld {
string say_hello(string name)
}

Then you generate code for Go proxies and stubs. On the server you just implement
the service methods, e.g.:

func (base *ImplHelloWorldServer) say_hello (name string) string {
return "Hello World to " + name
}

On the client you start a remote connection and call the service:

remote := NewRemoteServer("127.0.0.1:4001")
remote.TransportControl(etch.START_AND_WAIT_UP, 4000)
returnString := remote.Say_hello("Test")

So far it supports everything you know from protocol buffers, but also
provides defined RPC semantics. It supports bidirectional (server- and
client-directed) calls, blocking and non-blocking calls, user defined types,
error handling, and other things. The transport is binary-encoded for
efficiency, other language bindings also support xml.

Apache Etch is available for Go in an early alpha version. There are other
language bindings for Java, C and C#, check http://incubator.apache.org/etch/

The Go Binding is available in the binding-go folder of our trunk at
http://svn.apache.org/repos/asf/incubator/etch/trunk/

There is a pre-generated example for you to have a closer look at
http://svn.apache.org/repos/asf/incubator/etch/trunk/binding-go/runtime/src/test/go/example/

We are very happy to hear your feedback. If you like Etch or want to get
involved, we are happy to get in contact!

Looking forward to your comments,
Holger

Archos

unread,
Nov 30, 2010, 1:44:32 PM11/30/10
to golang-nuts
It could be used the next code to format the output. You have to
substitute "SOURCE" with a variable of type string, []byte, or
io.Reader [1]

* * *
import (
"go/parser"
"go/printer"
)

// Values by default used in 'gofmt'.
const (
_PARSER_MODE = parser.ParseComments
_PRINTER_MODE = printer.TabIndent | printer.UseSpaces
_TAB_WIDTH = 8
)

// Formats the Go source code.
func format(output io.Writer) {
ast, err := parser.ParseFile("", SOURCE, 0)
if err != nil {
goto _error
}

_, err = (&printer.Config{_PRINTER_MODE, _TAB_WIDTH,
nil}).Fprint(output, ast)
if err != nil {
goto _error
}

return

_error:
fmt.Fprintf(os.Stderr, "Can not format Go source code:", err)
os.Exit(2)
}
* * *

[1]: http://golang.org/pkg/go/parser/#ParseFile


On Nov 30, 1:17 pm, Holger Grandy <Holger.Gra...@bmw-carit.de> wrote:
> Hi,
>
> the Apache Etch service communication framework recently integrated a new binding
> for Go, which we want to share with you.
>
> Etch is a RPC-like service framework. You write service descriptions, e.g.:
>
> service HelloWorld {
>   string say_hello(string name)
>
> }
>
> Then you generate code for Go proxies and stubs. On the server you just implement
> the service methods, e.g.:
>
> func (base *ImplHelloWorldServer) say_hello (name string) string {
>   return "Hello World to " + name
>
> }  
>
> On the client you start a remote connection and call the service:
>
>  remote := NewRemoteServer("127.0.0.1:4001")
>  remote.TransportControl(etch.START_AND_WAIT_UP, 4000)
>  returnString := remote.Say_hello("Test")
>
> So far it supports everything you know from protocol buffers, but also
> provides defined RPC semantics. It supports bidirectional (server- and
> client-directed) calls, blocking and non-blocking calls, user defined types,
> error handling, and other things. The transport is binary-encoded for
> efficiency, other language bindings also support xml.
>
> Apache Etch is available for Go in an early alpha version. There are other
> language bindings for Java, C and C#, checkhttp://incubator.apache.org/etch/
>
> The Go Binding is available in the binding-go folder of our trunk athttp://svn.apache.org/repos/asf/incubator/etch/trunk/
>
> There is a pre-generated example for you to have a closer look athttp://svn.apache.org/repos/asf/incubator/etch/trunk/binding-go/runti...

Archos

unread,
Nov 30, 2010, 1:52:13 PM11/30/10
to golang-nuts
Sorry! This line:
ast, err := parser.ParseFile("", SOURCE, 0)
has to be:
ast, err := parser.ParseFile("", SOURCE, _PARSER_MODE)
Reply all
Reply to author
Forward
0 new messages