Skip to content

Getting started aka Hello World

Leon Rosenberg edited this page Jun 16, 2018 · 2 revisions

Getting started

This page explains how to write your very first service with DistributeMe. This involves some simple steps.

The first service

Our first service will be pretty straight forward. It does almost nothing, but prints something into console. DistributeMe is all about interfaces, and therefore we first have to define the interface: HelloWorldService.java

package org.distributeme.examples.helloworld;
 
import net.anotheria.anoprise.metafactory.Service;
import org.distributeme.annotation.DistributeMe;
 
@DistributeMe
public interface HelloWorldService extends Service{
    void printMessage(String message);
}

There are actually two things that differ from any other normal interface of a service:

  • @DistributeMe annotation above the interface declaration which tell the preprocessor to generate java code for this service and which can contain additional generation parameters we will care about later.
  • extends Service{ - which is needed by DistributeMe internal DI management. It's an empty interface, which signalizes that this component is a service and not of further interest now.
Clone this wiki locally