org.apache.kafka.clients.producer.internals.TransactionalRequestResult Java Examples

The following examples show how to use org.apache.kafka.clients.producer.internals.TransactionalRequestResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlinkKafkaInternalProducer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Besides committing {@link org.apache.kafka.clients.producer.KafkaProducer#commitTransaction} is also adding new
 * partitions to the transaction. flushNewPartitions method is moving this logic to pre-commit/flush, to make
 * resumeTransaction simpler. Otherwise resumeTransaction would require to restore state of the not yet added/"in-flight"
 * partitions.
 */
private void flushNewPartitions() {
	LOG.info("Flushing new partitions");
	TransactionalRequestResult result = enqueueNewPartitions();
	Object sender = getValue(kafkaProducer, "sender");
	invoke(sender, "wakeup");
	result.await();
}
 
Example #2
Source File: FlinkKafkaInternalProducer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private TransactionalRequestResult enqueueNewPartitions() {
	Object transactionManager = getValue(kafkaProducer, "transactionManager");
	synchronized (transactionManager) {
		Object txnRequestHandler = invoke(transactionManager, "addPartitionsToTransactionHandler");
		invoke(transactionManager, "enqueueRequest", new Class[]{txnRequestHandler.getClass().getSuperclass()}, new Object[]{txnRequestHandler});
		TransactionalRequestResult result = (TransactionalRequestResult) getValue(txnRequestHandler, txnRequestHandler.getClass().getSuperclass(), "result");
		return result;
	}
}
 
Example #3
Source File: FlinkKafkaProducer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Besides committing {@link org.apache.kafka.clients.producer.KafkaProducer#commitTransaction} is also adding new
 * partitions to the transaction. flushNewPartitions method is moving this logic to pre-commit/flush, to make
 * resumeTransaction simpler. Otherwise resumeTransaction would require to restore state of the not yet added/"in-flight"
 * partitions.
 */
private void flushNewPartitions() {
	LOG.info("Flushing new partitions");
	TransactionalRequestResult result = enqueueNewPartitions();
	Object sender = getValue(kafkaProducer, "sender");
	invoke(sender, "wakeup");
	result.await();
}
 
Example #4
Source File: FlinkKafkaProducer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private TransactionalRequestResult enqueueNewPartitions() {
	Object transactionManager = getValue(kafkaProducer, "transactionManager");
	synchronized (transactionManager) {
		Object txnRequestHandler = invoke(transactionManager, "addPartitionsToTransactionHandler");
		invoke(transactionManager, "enqueueRequest", new Class[]{txnRequestHandler.getClass().getSuperclass()}, new Object[]{txnRequestHandler});
		TransactionalRequestResult result = (TransactionalRequestResult) getValue(txnRequestHandler, txnRequestHandler.getClass().getSuperclass(), "result");
		return result;
	}
}
 
Example #5
Source File: FlinkKafkaInternalProducer.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Besides committing {@link org.apache.kafka.clients.producer.KafkaProducer#commitTransaction} is also adding new
 * partitions to the transaction. flushNewPartitions method is moving this logic to pre-commit/flush, to make
 * resumeTransaction simpler. Otherwise resumeTransaction would require to restore state of the not yet added/"in-flight"
 * partitions.
 */
private void flushNewPartitions() {
	LOG.info("Flushing new partitions");
	TransactionalRequestResult result = enqueueNewPartitions();
	Object sender = getValue(kafkaProducer, "sender");
	invoke(sender, "wakeup");
	result.await();
}
 
Example #6
Source File: FlinkKafkaInternalProducer.java    From flink with Apache License 2.0 5 votes vote down vote up
private TransactionalRequestResult enqueueNewPartitions() {
	Object transactionManager = getValue(kafkaProducer, "transactionManager");
	synchronized (transactionManager) {
		Object txnRequestHandler = invoke(transactionManager, "addPartitionsToTransactionHandler");
		invoke(transactionManager, "enqueueRequest", new Class[]{txnRequestHandler.getClass().getSuperclass()}, new Object[]{txnRequestHandler});
		TransactionalRequestResult result = (TransactionalRequestResult) getValue(txnRequestHandler, txnRequestHandler.getClass().getSuperclass(), "result");
		return result;
	}
}
 
Example #7
Source File: FlinkKafkaProducer.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Besides committing {@link org.apache.kafka.clients.producer.KafkaProducer#commitTransaction} is also adding new
 * partitions to the transaction. flushNewPartitions method is moving this logic to pre-commit/flush, to make
 * resumeTransaction simpler. Otherwise resumeTransaction would require to restore state of the not yet added/"in-flight"
 * partitions.
 */
private void flushNewPartitions() {
	LOG.info("Flushing new partitions");
	TransactionalRequestResult result = enqueueNewPartitions();
	Object sender = getValue(kafkaProducer, "sender");
	invoke(sender, "wakeup");
	result.await();
}
 
Example #8
Source File: FlinkKafkaProducer.java    From flink with Apache License 2.0 5 votes vote down vote up
private TransactionalRequestResult enqueueNewPartitions() {
	Object transactionManager = getValue(kafkaProducer, "transactionManager");
	synchronized (transactionManager) {
		Object txnRequestHandler = invoke(transactionManager, "addPartitionsToTransactionHandler");
		invoke(transactionManager, "enqueueRequest", new Class[]{txnRequestHandler.getClass().getSuperclass()}, new Object[]{txnRequestHandler});
		TransactionalRequestResult result = (TransactionalRequestResult) getValue(txnRequestHandler, txnRequestHandler.getClass().getSuperclass(), "result");
		return result;
	}
}
 
Example #9
Source File: FlinkKafkaInternalProducer.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Besides committing {@link org.apache.kafka.clients.producer.KafkaProducer#commitTransaction} is also adding new
 * partitions to the transaction. flushNewPartitions method is moving this logic to pre-commit/flush, to make
 * resumeTransaction simpler. Otherwise resumeTransaction would require to restore state of the not yet added/"in-flight"
 * partitions.
 */
private void flushNewPartitions() {
	LOG.info("Flushing new partitions");
	TransactionalRequestResult result = enqueueNewPartitions();
	Object sender = getField(kafkaProducer, "sender");
	invoke(sender, "wakeup");
	result.await();
}
 
Example #10
Source File: FlinkKafkaProducer.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Besides committing {@link org.apache.kafka.clients.producer.KafkaProducer#commitTransaction} is also adding new
 * partitions to the transaction. flushNewPartitions method is moving this logic to pre-commit/flush, to make
 * resumeTransaction simpler. Otherwise resumeTransaction would require to restore state of the not yet added/"in-flight"
 * partitions.
 */
private void flushNewPartitions() {
	LOG.info("Flushing new partitions");
	TransactionalRequestResult result = enqueueNewPartitions();
	Object sender = getValue(kafkaProducer, "sender");
	invoke(sender, "wakeup");
	result.await();
}