Clone Quickstart Project
Clone the Spring Boot Quickstart project from Github.
git clone -b 1.6.0 --single-branch https://github.com/netifi/proteus-spring-quickstart.git
Build the Project
After you have cloned the project change to the proteus-quickstart directory and build the project:
cd proteus-spring-quickstart ./gradlew build
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 \ -p 9000:9000 \ -e BROKER_SERVER_OPTS=" \ '-Dnetifi.broker.console.enabled=true' \ '-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/proteus:1.6.0
Start the Example Service
Back in the proteus-quickstart directory start up the service by running the following command:
This will startup a simple service that connects to the router.
Run the Example Client
Open another terminal window and go the proteus-quickstart 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 router, send the message to the service, and receive the response.
The following is approximately the expected output from the client:
$ ./gradlew :client:run ... 2018-09-03 14:16:39.460 INFO 46998 --- [main] i.n.p.quickstart.client.ClientRunner : Sending 'World' to HelloService... 2018-09-03 14:16:39.571 INFO 46998 --- [main] i.n.p.quickstart.client.ClientRunner : message: "Hello, World! from SayHello" ...
The service logs should show that it has received the message:
2018-09-03 14:16:39.561 INFO 46994 --- [actor-tcp-nio-6] i.n.p.q.service.DefaultHelloService : received a message -> World
Spring Boot Quickstart
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.
Follow the steps below to get up and running with Netifi quickly.
You were able to get a Netifi Broker up and running and send a message between a client and a microservice.