Create README.md
1 file changed
tree: 811ea3d7185dc9f2f80ee2d328875cbb013bbdbb
  1. src/
  2. .gitignore
  3. pom.xml
  4. README.md
README.md

Introduction

There will have two parts in this repo

  • AsyncSignal class specially designed to distinguish async method.
  • A compiler hacker processer that is able to generate async counterpart for each method in you Dubbo service interface.

AsyncSignal

AsyncSignal is an optional convenient type provided to unify your service definitions.

Imagine you have a Dubbo service defined like this:

public interface GreetingsService {
    String sayHi(String name);
}

Add an overwrite counterpart method.

public interface GreetingsService {
    String sayHi(String name);
    
    // AsyncSignal is totally optional, you can use any parameter type as long as java allows your overwrite.
    default CompletableFuture<String> sayHi(String name, AsyncSignal signal) {
        return CompletableFuture.completedFuture(sayHi(name));
    }
}

Now, you can call the new method with the CompletableFuture signature directly on Consumer side.

Compiler hacker processer

It should run at compile time, and overwrite each method in your service definition with an async equivalence. I think we can try to realize it by referencing lombok.