Lifecycle

Kevoree provides a way for developers to manage their instances lifecycle using hooks.
There are 3 different hooks available: start, update and stop.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@ComponentType(version = 1)
public class HelloWorld {

    @Start
    public void start() {
        System.out.println("Hello World!");
    }

    @Update
    public void update() {
        System.out.println("My world is changing");
    }

    @Stop
    public void stop() {
        System.out.println("Bye World!");
    }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const AbstractComponent = require('kevoree-entities/lib/AbstractComponent');

const HelloWorld = AbstractComponent.extend({
  toString: 'HelloWorld',
  tdef_version: 1,

  start(done) {
    this.log.info('Hello world!');
    done();
  },

  update(done) {
    this.log.info('My world is changing');
    done();
  },

  stop(done) {
    this.log.info('Bye world!');
    done();
  }
});