Search in sources :

Example 1 with CommandLookupTopicResponse

use of org.apache.pulsar.common.api.proto.CommandLookupTopicResponse in project pulsar by apache.

the class Commands method newLookupResponseCommand.

public static BaseCommand newLookupResponseCommand(String brokerServiceUrl, String brokerServiceUrlTls, boolean authoritative, LookupType lookupType, long requestId, boolean proxyThroughServiceUrl) {
    BaseCommand cmd = localCmd(Type.LOOKUP_RESPONSE);
    CommandLookupTopicResponse response = cmd.setLookupTopicResponse().setResponse(lookupType).setRequestId(requestId).setAuthoritative(authoritative).setProxyThroughServiceUrl(proxyThroughServiceUrl);
    if (brokerServiceUrl != null) {
        response.setBrokerServiceUrl(brokerServiceUrl);
    }
    if (brokerServiceUrlTls != null) {
        response.setBrokerServiceUrlTls(brokerServiceUrlTls);
    }
    return cmd;
}
Also used : BaseCommand(org.apache.pulsar.common.api.proto.BaseCommand) CommandLookupTopicResponse(org.apache.pulsar.common.api.proto.CommandLookupTopicResponse)

Example 2 with CommandLookupTopicResponse

use of org.apache.pulsar.common.api.proto.CommandLookupTopicResponse in project pulsar by apache.

the class Commands method newLookupErrorResponseCommand.

public static BaseCommand newLookupErrorResponseCommand(ServerError error, String errorMsg, long requestId) {
    BaseCommand cmd = localCmd(Type.LOOKUP_RESPONSE);
    CommandLookupTopicResponse response = cmd.setLookupTopicResponse().setRequestId(requestId).setError(error).setResponse(LookupType.Failed);
    if (errorMsg != null) {
        response.setMessage(errorMsg);
    }
    return cmd;
}
Also used : BaseCommand(org.apache.pulsar.common.api.proto.BaseCommand) CommandLookupTopicResponse(org.apache.pulsar.common.api.proto.CommandLookupTopicResponse)

Example 3 with CommandLookupTopicResponse

use of org.apache.pulsar.common.api.proto.CommandLookupTopicResponse in project pulsar by yahoo.

the class Commands method newLookupResponseCommand.

public static BaseCommand newLookupResponseCommand(String brokerServiceUrl, String brokerServiceUrlTls, boolean authoritative, LookupType lookupType, long requestId, boolean proxyThroughServiceUrl) {
    BaseCommand cmd = localCmd(Type.LOOKUP_RESPONSE);
    CommandLookupTopicResponse response = cmd.setLookupTopicResponse().setResponse(lookupType).setRequestId(requestId).setAuthoritative(authoritative).setProxyThroughServiceUrl(proxyThroughServiceUrl);
    if (brokerServiceUrl != null) {
        response.setBrokerServiceUrl(brokerServiceUrl);
    }
    if (brokerServiceUrlTls != null) {
        response.setBrokerServiceUrlTls(brokerServiceUrlTls);
    }
    return cmd;
}
Also used : BaseCommand(org.apache.pulsar.common.api.proto.BaseCommand) CommandLookupTopicResponse(org.apache.pulsar.common.api.proto.CommandLookupTopicResponse)

Example 4 with CommandLookupTopicResponse

use of org.apache.pulsar.common.api.proto.CommandLookupTopicResponse in project pulsar by yahoo.

the class ServerCnxTest method testInvalidTopicOnLookup.

@Test(timeOut = 30000)
public void testInvalidTopicOnLookup() throws Exception {
    resetChannel();
    setChannelConnected();
    String invalidTopicName = "xx/ass/aa/aaa";
    resetChannel();
    setChannelConnected();
    channel.writeInbound(Commands.newLookup(invalidTopicName, true, 1));
    Object obj = getResponse();
    assertEquals(obj.getClass(), CommandLookupTopicResponse.class);
    CommandLookupTopicResponse res = (CommandLookupTopicResponse) obj;
    assertEquals(res.getError(), ServerError.InvalidTopicName);
    channel.finish();
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) CommandLookupTopicResponse(org.apache.pulsar.common.api.proto.CommandLookupTopicResponse) Test(org.testng.annotations.Test)

Example 5 with CommandLookupTopicResponse

use of org.apache.pulsar.common.api.proto.CommandLookupTopicResponse in project incubator-pulsar by apache.

the class Commands method newLookupResponseCommand.

public static BaseCommand newLookupResponseCommand(String brokerServiceUrl, String brokerServiceUrlTls, boolean authoritative, LookupType lookupType, long requestId, boolean proxyThroughServiceUrl) {
    BaseCommand cmd = localCmd(Type.LOOKUP_RESPONSE);
    CommandLookupTopicResponse response = cmd.setLookupTopicResponse().setResponse(lookupType).setRequestId(requestId).setAuthoritative(authoritative).setProxyThroughServiceUrl(proxyThroughServiceUrl);
    if (brokerServiceUrl != null) {
        response.setBrokerServiceUrl(brokerServiceUrl);
    }
    if (brokerServiceUrlTls != null) {
        response.setBrokerServiceUrlTls(brokerServiceUrlTls);
    }
    return cmd;
}
Also used : BaseCommand(org.apache.pulsar.common.api.proto.BaseCommand) CommandLookupTopicResponse(org.apache.pulsar.common.api.proto.CommandLookupTopicResponse)

Aggregations

CommandLookupTopicResponse (org.apache.pulsar.common.api.proto.CommandLookupTopicResponse)12 BaseCommand (org.apache.pulsar.common.api.proto.BaseCommand)6 PulsarClientException (org.apache.pulsar.client.api.PulsarClientException)3 LookupDataResult (org.apache.pulsar.client.impl.BinaryProtoLookupService.LookupDataResult)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 Test (org.testng.annotations.Test)3