Service Tutorial

This tutorial describes how to create, develop and deploy a simple Hello World application using Rio.

Introduction

Rio provides a dynamic service oriented architecture, allowing the development, deployment and management of services through the network. Rio provides the ability to develop POJO based services, Spring supported deployment as well as using the Rio Service Bean approach.

Service Beans provide a simple component model defining lifecycle semantics of a dynamic service (start, init, advertise, unadvertise, stop, destroy). The fundamental premise is for the infrastructure to provide an easy to use programming model, whole maintaining access to lower level APIs such as Watches, Associations and Remote Events.

The POJO approach leverages the Service Bean model, allowing POJOs to be developed and deployed without using any Rio infrastructure code. Our example in this section uses a simple Hello World Plain Old Java Object (POJO). The bean is dynamically made available as a distributed service by Rio, allowing the bean to be accessed remotely, with built-in management, fault detection and automated deployment.

This example will also use a test client, showing how the service can be tested and invoked.

Note the declaration of
java.rmi.RemoteException for the hello method. This is required to distinguish that the method invocation is
remote-able. Why is this important? For one, the distinction between local invocation vs. remote invocation is a distinction that should not be papered over.

When developing a system composed of distributed services, the developer (and deployer) need to be aware of the semantics of remote invocations. Masking that a method may be local or remote can have adverse side-effects in the deployment of enterprise-wide systems, since such issues of partial failure and latency are not formal considerations of the designers and developers.

Rio provides great utility here, especially in the context of Associations, however, the enforcement of declaring throws
RemoteException for methods that are to be invoked remotely is a requirement when developing services with Rio.

The implementation of the bean for the Hello interface is equally as simple. You'll need to implement the hello method:

Build and Deploy

Once you've made those modifications, the example can be run during the integration-test lifecycle phase of the project (see the declaration of the failsafe-maven-plugin in the pom), or by deploying the example to a running Rio system.

To deploy the example to a running Rio system:

Note: Make sure your project is built. If you run mvn install, your project will be built, packaged tested and installed to your local repository. The integration tests include starting Rio services and deploying the application. If you want to skip the tests and just deploy the project, run mvn install -Dmaven.test.skip and follow the steps below.