apache/dubbo

[Feature] Can @Method annotation provide more possibilities to control which @Method ultimately takes effect with minimal granularity, including on methods of classes using @DubboService annotation, methods of parent classes, and abstract methods of interfaces

Open

#14.927 geöffnet am 23. Nov. 2024

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (26.453 Forks)batch import
help wantedtype/enhancementtype/proposal

Repository-Metriken

Stars
 (41.524 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 7T 14h) (20 gemergte PRs in 30 T)

Beschreibung

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Apache Dubbo Component

Java SDK (apache/dubbo)

Descriptions

Can @method annotation provide more possibilities to control which @method ultimately takes effect with minimal granularity, including on methods of classes using @DubboService annotation, methods of parent classes, and abstract methods of interfaces. And consider adding wildcard characters to match the methods.Or add an annotation for configuration. for example:

public interface TestGateway {
    Response create(String t);

    @Method(retries = 2, timeout = 1000)
    Response createOther(String t);

    @Method(retries = 2, timeout = 1000)
    Response createTest(String t);
}

@DubboService(interfaceClass = TestGateway.class, version = "1.0.0", group = "public",
        methods = {
                @Method(name = "create*", retries = 5, timeout = ,6000)
        }
)
public class TestGatewayImpl implements TestGateway {

    @Override
    public Response create(String t) {
        return Response.buildSuccess();
    }

    @Override
    public Response createOther(String t) {
        return Response.buildSuccess();
    }
    
    @Override
    @Method(retries = 1, timeout=500))
    public Response createTest(String t) {
        return Response.buildSuccess();
    }
}

In the above example, the retry count for create is 5, with a timeout of 6000 milliseconds. The retry count for create Other is 2, with a timeout of 1000 milliseconds. The retry count for create Test is 1, with a timeout of 500 milliseconds

Related issues

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

Contributor Guide