Search in sources :

Example 1 with CreateableTopicConfig

use of org.apache.kafka.common.message.CreateTopicsRequestData.CreateableTopicConfig in project kafka by apache.

the class RequestResponseTest method createCreateTopicRequest.

private CreateTopicsRequest createCreateTopicRequest(short version, boolean validateOnly) {
    CreateTopicsRequestData data = new CreateTopicsRequestData().setTimeoutMs(123).setValidateOnly(validateOnly);
    data.topics().add(new CreatableTopic().setNumPartitions(3).setReplicationFactor((short) 5));
    CreatableTopic topic2 = new CreatableTopic();
    data.topics().add(topic2);
    topic2.assignments().add(new CreatableReplicaAssignment().setPartitionIndex(0).setBrokerIds(asList(1, 2, 3)));
    topic2.assignments().add(new CreatableReplicaAssignment().setPartitionIndex(1).setBrokerIds(asList(2, 3, 4)));
    topic2.configs().add(new CreateableTopicConfig().setName("config1").setValue("value1"));
    return new CreateTopicsRequest.Builder(data).build(version);
}
Also used : CreatableTopic(org.apache.kafka.common.message.CreateTopicsRequestData.CreatableTopic) CreatableReplicaAssignment(org.apache.kafka.common.message.CreateTopicsRequestData.CreatableReplicaAssignment) CreateTopicsRequestData(org.apache.kafka.common.message.CreateTopicsRequestData) CreateableTopicConfig(org.apache.kafka.common.message.CreateTopicsRequestData.CreateableTopicConfig) Builder(org.apache.kafka.common.requests.CreateTopicsRequest.Builder)

Aggregations

CreateTopicsRequestData (org.apache.kafka.common.message.CreateTopicsRequestData)1 CreatableReplicaAssignment (org.apache.kafka.common.message.CreateTopicsRequestData.CreatableReplicaAssignment)1 CreatableTopic (org.apache.kafka.common.message.CreateTopicsRequestData.CreatableTopic)1 CreateableTopicConfig (org.apache.kafka.common.message.CreateTopicsRequestData.CreateableTopicConfig)1 Builder (org.apache.kafka.common.requests.CreateTopicsRequest.Builder)1