use of org.apache.kafka.streams.processor.internals.assignment.AssignorConfiguration in project kafka by apache.
the class StreamsPartitionAssignorTest method shouldGetTime.
@Test
public void shouldGetTime() {
time.setCurrentTimeMs(Long.MAX_VALUE);
createDefaultMockTaskManager();
final Map<String, Object> props = configProps();
final AssignorConfiguration assignorConfiguration = new AssignorConfiguration(props);
assertThat(assignorConfiguration.referenceContainer().time.milliseconds(), equalTo(Long.MAX_VALUE));
}
use of org.apache.kafka.streams.processor.internals.assignment.AssignorConfiguration in project kafka by apache.
the class StreamsPartitionAssignor method configure.
/**
* We need to have the PartitionAssignor and its StreamThread to be mutually accessible since the former needs
* latter's cached metadata while sending subscriptions, and the latter needs former's returned assignment when
* adding tasks.
*
* @throws KafkaException if the stream thread is not specified
*/
@Override
public void configure(final Map<String, ?> configs) {
final AssignorConfiguration assignorConfiguration = new AssignorConfiguration(configs);
logPrefix = assignorConfiguration.logPrefix();
log = new LogContext(logPrefix).logger(getClass());
usedSubscriptionMetadataVersion = assignorConfiguration.configuredMetadataVersion(usedSubscriptionMetadataVersion);
final ReferenceContainer referenceContainer = assignorConfiguration.referenceContainer();
mainConsumerSupplier = () -> Objects.requireNonNull(referenceContainer.mainConsumer, "Main consumer was not specified");
adminClient = Objects.requireNonNull(referenceContainer.adminClient, "Admin client was not specified");
taskManager = Objects.requireNonNull(referenceContainer.taskManager, "TaskManager was not specified");
streamsMetadataState = Objects.requireNonNull(referenceContainer.streamsMetadataState, "StreamsMetadataState was not specified");
assignmentErrorCode = referenceContainer.assignmentErrorCode;
nextScheduledRebalanceMs = referenceContainer.nextScheduledRebalanceMs;
nonFatalExceptionsToHandle = referenceContainer.nonFatalExceptionsToHandle;
time = Objects.requireNonNull(referenceContainer.time, "Time was not specified");
assignmentConfigs = assignorConfiguration.assignmentConfigs();
partitionGrouper = new PartitionGrouper();
userEndPoint = assignorConfiguration.userEndPoint();
internalTopicManager = assignorConfiguration.internalTopicManager();
copartitionedTopicsEnforcer = assignorConfiguration.copartitionedTopicsEnforcer();
rebalanceProtocol = assignorConfiguration.rebalanceProtocol();
taskAssignorSupplier = assignorConfiguration::taskAssignor;
assignmentListener = assignorConfiguration.assignmentListener();
uniqueField = 0;
}
Aggregations