forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
435 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
clients/src/main/java/org/apache/kafka/clients/admin/ListFederatedTopicZnodesOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.kafka.clients.admin; | ||
|
||
import org.apache.kafka.common.annotation.InterfaceStability; | ||
|
||
|
||
/** | ||
* Options for {@link Admin#listFederatedTopicZnodes()}. | ||
* | ||
* The API of this class is evolving, see {@link Admin} for details. | ||
*/ | ||
@InterfaceStability.Evolving | ||
public class ListFederatedTopicZnodesOptions extends AbstractOptions<ListFederatedTopicZnodesOptions> { | ||
} |
44 changes: 44 additions & 0 deletions
44
clients/src/main/java/org/apache/kafka/clients/admin/ListFederatedTopicZnodesResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.kafka.clients.admin; | ||
|
||
import java.util.List; | ||
import org.apache.kafka.common.KafkaFuture; | ||
import org.apache.kafka.common.annotation.InterfaceStability; | ||
|
||
|
||
/** | ||
* The result of the {@link Admin#listFederatedTopicZnodes()} call. | ||
* | ||
* The API of this class is evolving, see {@link Admin} for details. | ||
*/ | ||
@InterfaceStability.Evolving | ||
public class ListFederatedTopicZnodesResult { | ||
final KafkaFuture<List<String>> future; | ||
|
||
ListFederatedTopicZnodesResult(KafkaFuture<List<String>> future) { | ||
this.future = future; | ||
} | ||
|
||
/** | ||
* Return a future which yields a list of federated topic names | ||
*/ | ||
public KafkaFuture<List<String>> topics() { | ||
return future; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...nts/src/main/java/org/apache/kafka/common/requests/LiListFederatedTopicZnodesRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.kafka.common.requests; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.util.Collections; | ||
import org.apache.kafka.common.message.LiListFederatedTopicZnodesRequestData; | ||
import org.apache.kafka.common.message.LiListFederatedTopicZnodesResponseData; | ||
import org.apache.kafka.common.protocol.ApiKeys; | ||
import org.apache.kafka.common.protocol.ByteBufferAccessor; | ||
import org.apache.kafka.common.protocol.Errors; | ||
|
||
|
||
public class LiListFederatedTopicZnodesRequest extends AbstractRequest { | ||
public static class Builder extends AbstractRequest.Builder<LiListFederatedTopicZnodesRequest> { | ||
|
||
private final LiListFederatedTopicZnodesRequestData data; | ||
|
||
public Builder(LiListFederatedTopicZnodesRequestData data, short allowedVersion) { | ||
super(ApiKeys.LI_LIST_FEDERATED_TOPIC_ZNODES, allowedVersion); | ||
this.data = data; | ||
} | ||
|
||
@Override | ||
public LiListFederatedTopicZnodesRequest build(short version) { | ||
return new LiListFederatedTopicZnodesRequest(data, version); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return data.toString(); | ||
} | ||
} | ||
|
||
private final LiListFederatedTopicZnodesRequestData data; | ||
|
||
public LiListFederatedTopicZnodesRequest(LiListFederatedTopicZnodesRequestData data, short version) { | ||
super(ApiKeys.LI_LIST_FEDERATED_TOPIC_ZNODES, version); | ||
this.data = data; | ||
} | ||
|
||
@Override | ||
public LiListFederatedTopicZnodesResponse getErrorResponse(int throttleTimeMs, Throwable e) { | ||
LiListFederatedTopicZnodesResponseData data = new LiListFederatedTopicZnodesResponseData(). | ||
setTopics(Collections.emptyList()). | ||
setErrorCode(Errors.forException(e).code()); | ||
return new LiListFederatedTopicZnodesResponse(data, version()); | ||
} | ||
|
||
public static LiListFederatedTopicZnodesRequest parse(ByteBuffer buffer, short version) { | ||
return new LiListFederatedTopicZnodesRequest( | ||
new LiListFederatedTopicZnodesRequestData(new ByteBufferAccessor(buffer), version), version | ||
); | ||
} | ||
|
||
@Override | ||
public LiListFederatedTopicZnodesRequestData data() { | ||
return data; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
...ts/src/main/java/org/apache/kafka/common/requests/LiListFederatedTopicZnodesResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.kafka.common.requests; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.util.Map; | ||
import org.apache.kafka.common.message.LiListFederatedTopicZnodesResponseData; | ||
import org.apache.kafka.common.protocol.ApiKeys; | ||
import org.apache.kafka.common.protocol.ByteBufferAccessor; | ||
import org.apache.kafka.common.protocol.Errors; | ||
|
||
|
||
public class LiListFederatedTopicZnodesResponse extends AbstractResponse { | ||
private final LiListFederatedTopicZnodesResponseData data; | ||
private final short version; | ||
|
||
public LiListFederatedTopicZnodesResponse(LiListFederatedTopicZnodesResponseData data, short version) { | ||
super(ApiKeys.LI_LIST_FEDERATED_TOPIC_ZNODES); | ||
this.data = data; | ||
this.version = version; | ||
} | ||
|
||
@Override | ||
public LiListFederatedTopicZnodesResponseData data() { | ||
return data; | ||
} | ||
|
||
@Override | ||
public int throttleTimeMs() { | ||
return data.throttleTimeMs(); | ||
} | ||
|
||
@Override | ||
public Map<Errors, Integer> errorCounts() { | ||
return errorCounts(Errors.forCode(data.errorCode())); | ||
} | ||
|
||
public static LiListFederatedTopicZnodesResponse parse(ByteBuffer buffer, short version) { | ||
return new LiListFederatedTopicZnodesResponse( | ||
new LiListFederatedTopicZnodesResponseData(new ByteBufferAccessor(buffer), version), version | ||
); | ||
} | ||
|
||
public static LiListFederatedTopicZnodesResponse prepareResponse(Errors error, int throttleTimeMs, short version) { | ||
LiListFederatedTopicZnodesResponseData data = new LiListFederatedTopicZnodesResponseData(); | ||
data.setErrorCode(error.code()); | ||
data.setThrottleTimeMs(throttleTimeMs); | ||
return new LiListFederatedTopicZnodesResponse(data, version); | ||
} | ||
|
||
public short version() { | ||
return version; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return data.toString(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
clients/src/main/resources/common/message/LiListFederatedTopicZnodesRequest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more | ||
// contributor license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright ownership. | ||
// The ASF licenses this file to You under the Apache License, Version 2.0 | ||
// (the "License"); you may not use this file except in compliance with | ||
// the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
{ | ||
"apiKey": 1005, | ||
"type": "request", | ||
"listeners": ["zkBroker"], | ||
"name": "LiListFederatedTopicZnodesRequest", | ||
"validVersions": "0-1", | ||
"flexibleVersions": "0+", | ||
"fields": [ | ||
{ "name": "Topics", "type": "[]FederatedTopics", "versions": "0+", "about": "The simple name of the federated topics", | ||
"fields": [ | ||
{"name": "Name", "type": "string", "versions": "0+", "about": "The topic name"} | ||
]} | ||
] | ||
} |
Oops, something went wrong.