Search in sources :

Example 1 with FunctionStatusList

use of org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatusList in project incubator-pulsar by apache.

the class FunctionsImpl method getFunctionStatus.

@Override
public FunctionStatusList getFunctionStatus(String tenant, String namespace, String function) throws PulsarAdminException {
    try {
        Response response = request(functions.path(tenant).path(namespace).path(function).path("status")).get();
        if (!response.getStatusInfo().equals(Response.Status.OK)) {
            throw new ClientErrorException(response);
        }
        String jsonResponse = response.readEntity(String.class);
        FunctionStatusList.Builder functionStatusBuilder = FunctionStatusList.newBuilder();
        Utils.mergeJson(jsonResponse, functionStatusBuilder);
        return functionStatusBuilder.build();
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : Response(javax.ws.rs.core.Response) FunctionStatusList(org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatusList) ClientErrorException(javax.ws.rs.ClientErrorException) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException) ClientErrorException(javax.ws.rs.ClientErrorException)

Aggregations

ClientErrorException (javax.ws.rs.ClientErrorException)1 Response (javax.ws.rs.core.Response)1 PulsarAdminException (org.apache.pulsar.client.admin.PulsarAdminException)1 FunctionStatusList (org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatusList)1