Install rsocket-rpc-go plugin
go get -u github.com/rsocket/rsocket-rpc-go/protoc-gen-go
Clone Quickstart Project
Clone the Go Quickstart project from Github.
git clone -b develop --single-branch https://github.com/netifi/netifi-quickstart-go.git
Build the Project
After you have cloned the project change to the netifi-quickstart-go directory and build the project:
cd netifi-quickstart-go make
Start the Broker
Once the project is built you need to start the broker. The Netifi Broker is packaged and distributed as a Docker container. To start the Broker run the following command in another terminal window:
docker run \ -p 7001:7001 \ -p 8001:8001 \ -p 8101:8101 \ -e BROKER_SERVER_OPTS=" \ '-Dnetifi.broker.ssl.disabled=true' \ '-Dnetifi.authentication.0.accessKey=9007199254740991' \ '-Dnetifi.authentication.0.accessToken=kTBDVtfRBO4tHOnZzSyY5ym2kfY=' \ '-Dnetifi.broker.admin.accessKey=9007199254740991' \ '-Dnetifi.broker.admin.accessToken=kTBDVtfRBO4tHOnZzSyY5ym2kfY='" \ netifi/broker:1.6.9
Start the Example Service
Back in the netifi-quickstart-go directory start up the service by running the following command:
This will startup a simple service that connects to the broker.
Run the Example Client
Open another terminal window and go the netifi-quickstart-go directory. This time instead of starting the service, use a client to send a message. This can be done by running the following command:
The client will startup, connect to the broker, and send a message to the service.
The following is approximately the expected output from the client:
$ ./client ... 2019/08/06 11:38:48 selecting new rsocket 2019/08/06 11:38:48 no active rsocket attempting to connect to tcp://localhost:8001 2019/08/06 11:38:48 successfully connected to tcp://localhost:8001 message:"Hello, go" ...
The service logs should show that it has received the message:
2019/08/06 11:45:32 received a message -> go
And the broker should show something akin to this:
2019-08-06 11:38:48,898 INFO c.n.b.a.BrokerSocketAcceptor [reactor-tcp-nio-4] adding destination 3843195d-23e3-4928-807f-d8f912152535 to group helloGoClient 2019-08-06 11:38:48,898 INFO c.n.b.a.ClusterSocketAcceptor [reactor-tcp-nio-4] adding destination 3843195d-23e3-4928-807f-d8f912152535 with tags [tag(com.netifi.destination=3843195d-23e3-4928-807f-d8f912152535)] to group helloGoClient 2019-08-06 11:38:48,901 INFO c.n.b.a.BrokerSocketAcceptor [reactor-tcp-nio-4] removing destination 3843195d-23e3-4928-807f-d8f912152535 from group helloGoClient 2019-08-06 11:38:48,902 INFO c.n.b.a.ClusterSocketAcceptor [reactor-tcp-nio-4] removing destination 3843195d-23e3-4928-807f-d8f912152535 from group helloGoClient 2019-08-06 11:38:48,902 INFO c.n.b.a.BrokerSocketAcceptor [reactor-tcp-nio-4] removing destination 3843195d-23e3-4928-807f-d8f912152535 from destination map r
In this quickstart you will create a service that receives a name from a client and responds to the client with a message. Communication between the client and service is facilitated by the Netifi Broker.
This is an early release, and under development. We are actively looking for feedback while we develop our go client, and work with the community on rsocket-go.
Follow the steps below to get up and running with Netifi quickly.