Annotations

Infinitic is still in active development. Subscribe here to follow its progress.

@Name

A task instance is internally described by both its full java name (including its package) and the name of the method called.

In some situations we may want to avoid coupling those names with the underlying implementation, for example if we want to rename the class or method, or if we mix programming languages.

Infinitic provides a @Name annotation that let us declare explicitly the names that Infinitic should use internally. For example:

package hello.world.tasks;

import io.infinitic.annotations.Name;

@Name("HelloService")
public interface HelloWorldService {
    @Name("sayHelloTask")
    String sayHello(String name);

    @Name("addEnthusiasmTask")
    String addEnthusiasm(String str);
}
package hello.world.tasks

import io.infinitic.annotations.Name

@Name('HelloService')
interface HelloWorldService {

    @Name('sayHelloTask')
    fun sayHello(name: String?): String

    @Name('addEnthusiasmTask')
    fun addEnthusiasm(str: String): String
}

When using this annotation, the name setting in task worker configuration file should be the one provided by the annotation:

tasks:
  - name: HelloService
    class: hello.world.tasks.HelloWorldServiceImpl
Edit this page on GitHub Updated at Mon, Oct 25, 2021