@Override public StreamSpec copyWithPartitionCount(int partitionCount) { return new KafkaStreamSpec(getId(), getPhysicalName(), getSystemName(), partitionCount, getReplicationFactor(), getProperties()); }
/** * Make a copy of the spec with new properties * @param properties properties of the Kafka stream * @return new instance of {@link KafkaStreamSpec} */ public KafkaStreamSpec copyWithProperties(Properties properties) { return new KafkaStreamSpec(getId(), getPhysicalName(), getSystemName(), getPartitionCount(), getReplicationFactor(), properties); }
public Properties getProperties() { return mapToProperties(getConfig()); } }
public KafkaStreamSpec copyWithReplicationFactor(int replicationFactor) { return new KafkaStreamSpec(getId(), getPhysicalName(), getSystemName(), getPartitionCount(), replicationFactor, getProperties()); }
@Override public boolean createStream(StreamSpec streamSpec) { LOG.info("Creating Kafka topic: {} on system: {}", streamSpec.getPhysicalName(), streamSpec.getSystemName()); return KafkaSystemAdminUtilsScala.createStream(toKafkaSpec(streamSpec), getZkConnection()); }
/** * Delete records up to (and including) the provided ssp offsets for * all system stream partitions specified in the map. * This only works with Kafka cluster 0.11 or later. Otherwise it's a no-op. * @param offsets specifies up to what offsets the messages should be deleted */ @Override public void deleteMessages(Map<SystemStreamPartition, String> offsets) { if (deleteCommittedMessages) { if (adminClientForDelete == null) { adminClientForDelete = kafka.admin.AdminClient.create(createAdminClientProperties()); } KafkaSystemAdminUtilsScala.deleteMessages(adminClientForDelete, offsets); deleteMessageCalled = true; } }
@Override public void close(long timeout, TimeUnit timeUnit) { closed = true; // The real producer will flush messages as part of closing. We'll invoke flush here to approximate that behavior. new FlushRunnable(0).run(); }
@Test public void testConfigValidations() { final KafkaSystemConsumer consumer = createConsumer(FETCH_THRESHOLD_MSGS, FETCH_THRESHOLD_BYTES); consumer.start(); // should be no failures }
@Test(expected = StreamValidationException.class) public void testValidateStreamDoesNotExist() { StreamSpec spec = new StreamSpec("testId", "testStreamNameExist", "testSystem", 8); systemAdmin().validateStream(spec); }
@Override public Future<RecordMetadata> send(ProducerRecord record) { return send(record, null); }
@Override public void close() { close(Long.MAX_VALUE, TimeUnit.MILLISECONDS); }
@Override public StreamSpec copyWithPartitionCount(int partitionCount) { return new KafkaStreamSpec(getId(), getPhysicalName(), getSystemName(), partitionCount, getReplicationFactor(), getProperties()); }
/** * Make a copy of the spec with new properties * @param properties properties of the Kafka stream * @return new instance of {@link KafkaStreamSpec} */ public KafkaStreamSpec copyWithProperties(Properties properties) { return new KafkaStreamSpec(getId(), getPhysicalName(), getSystemName(), getPartitionCount(), getReplicationFactor(), properties); }
public KafkaStreamSpec copyWithReplicationFactor(int replicationFactor) { return new KafkaStreamSpec(getId(), getPhysicalName(), getSystemName(), getPartitionCount(), replicationFactor, getProperties()); }
public Properties getProperties() { return mapToProperties(getConfig()); } }
public synchronized void flush () { new FlushRunnable(0).run(); }
@Override public StreamSpec copyWithPartitionCount(int partitionCount) { return new KafkaStreamSpec(getId(), getPhysicalName(), getSystemName(), partitionCount, getReplicationFactor(), getProperties()); }
/** * Make a copy of the spec with new properties * @param properties properties of the Kafka stream * @return new instance of {@link KafkaStreamSpec} */ public KafkaStreamSpec copyWithProperties(Properties properties) { return new KafkaStreamSpec(getId(), getPhysicalName(), getSystemName(), getPartitionCount(), getReplicationFactor(), properties); }
public KafkaStreamSpec copyWithReplicationFactor(int replicationFactor) { return new KafkaStreamSpec(getId(), getPhysicalName(), getSystemName(), getPartitionCount(), replicationFactor, getProperties()); }
public Properties getProperties() { return mapToProperties(getConfig()); } }