Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.05 KB

readme.md

File metadata and controls

57 lines (41 loc) · 1.05 KB

Custom Handler Sample

It's the sample of customer handler sample

It will introduce how to write a customer handler

1. Implements AbstractHandler

public class MyHandler extends AbstractHandler {
    @Override
    public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
        // code before

        invocation.next(response -> {
            // code after
            asyncResp.handle(response);
        });
    }
}

2. Add config config/cse.handler.xml of handler

<config>
    <handler id="myhandler" class="xxx.xxx.xxx.MyHandler" />
</config>

3 add handler in microservice.yaml

cse:
  handler:
    chain:
      Provider:
        default: bizkeeper-provider,tracing-provider,sla-provider,perf-stats,myhandler

How to run sample

1. Start the ServiceComb/Service Center

how to start the service center

2.Start the Microservice server

mvn test -Pserver

3.Start the Microservice client

mvn test -Pclient