Spring Boot Quickstart

Overview

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 Proteus Broker.

Prerequisites

You need the following items installed on your machine to run the quickstart:

Get Started

Follow the steps below to get up and running with Proteus quickly.

  1. Clone Quickstart Project

    Clone the Spring Boot Quickstart project from Github.

    git clone https://github.com/netifi/proteus-spring-quickstart proteus-spring-quickstart
  2. 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
  3. Start the Router

    Once the project is built you need to start the broker. The Proteus Broker is packaged and distributed as a Docker container. To start the Broker run the following command in another terminal window:

    docker run \
    -p 8001:8001 \
    -p 7001:7001 \
    -p 9000:9000 \
    -e BROKER_SERVER_OPTS="'-Dnetifi.authentication.0.accessKey=9007199254740991'  \
    '-Dnetifi.broker.console.enabled=true' \
    '-Dnetifi.authentication.0.accessToken=kTBDVtfRBO4tHOnZzSyY5ym2kfY=' \
    '-Dnetifi.broker.admin.accessKey=9007199254740991' \
    '-Dnetifi.broker.admin.accessToken=kTBDVtfRBO4tHOnZzSyY5ym2kfY='" \
    netifi/proteus:1.5.2
  4. Start the Example Service

    Back in the proteus-quickstart directory start up the service by running the following command:

    ./gradlew :service:run

    This will startup a simple service that connects to the router.

  5. 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:

    ./gradlew :client:run

    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

Congratulations!

You were able to get a Proteus Broker up and running and send a message between a client and a microservice.

Background Image

Check out our blog to learn more about Proteus and RSocket.

Read Our Blog