Clone Quickstart Project
Clone the Spring Boot Quickstart project from Github.
git clone -b 1.6.9 --single-branch https://github.com/netifi/netifi-quickstart-spring.git
Build the Project
After you have cloned the project change to the netifi-quickstart-spring directory and build the project:
cd netifi-quickstart-spring ./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 \ -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-spring 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 netifi-quickstart-spring 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:bootRun ... 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.