org.springframework.kafka.listener.DeadLetterPublishingRecoverer Java Examples

The following examples show how to use org.springframework.kafka.listener.DeadLetterPublishingRecoverer. 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: Application.java    From spring-cloud-contract-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public ConcurrentKafkaListenerContainerFactory<?, ?> kafkaListenerContainerFactory(
		ConcurrentKafkaListenerContainerFactoryConfigurer configurer,
		ConsumerFactory<Object, Object> kafkaConsumerFactory,
		KafkaTemplate<Object, Object> template) {
	ConcurrentKafkaListenerContainerFactory<Object, Object> factory = new ConcurrentKafkaListenerContainerFactory<>();
	configurer.configure(factory, kafkaConsumerFactory);
	factory.setErrorHandler(new SeekToCurrentErrorHandler(
			new DeadLetterPublishingRecoverer(template), 3)); // dead-letter after 3 tries
	return factory;
}
 
Example #2
Source File: KafkaDeadLetterErrorHandler.java    From faster-framework-project with Apache License 2.0 4 votes vote down vote up
public KafkaDeadLetterErrorHandler(KafkaTemplate<Object, Object> kafkaTemplate) {
    deadLetterPublishingRecoverer = new DeadLetterPublishingRecoverer(kafkaTemplate);
}
 
Example #3
Source File: KafkaDeadLetterBatchErrorHandler.java    From faster-framework-project with Apache License 2.0 4 votes vote down vote up
public KafkaDeadLetterBatchErrorHandler(KafkaTemplate<Object, Object> kafkaTemplate) {
    deadLetterPublishingRecoverer = new DeadLetterPublishingRecoverer(kafkaTemplate);
}
 
Example #4
Source File: SendToDlqAndContinue.java    From spring-cloud-stream-binder-kafka with Apache License 2.0 4 votes vote down vote up
void addKStreamDlqDispatch(String topic,
		DeadLetterPublishingRecoverer kafkaStreamsDlqDispatch) {
	this.dlqDispatchers.put(topic, kafkaStreamsDlqDispatch);
}
 
Example #5
Source File: SendToDlqAndContinue.java    From spring-cloud-stream-binder-kafka with Apache License 2.0 2 votes vote down vote up
/**
 * For a given topic, send the key/value record to DLQ topic.
 *
 * @param consumerRecord consumer record
 * @param exception exception
 */
public void sendToDlq(ConsumerRecord<?, ?> consumerRecord, Exception exception) {
	DeadLetterPublishingRecoverer kafkaStreamsDlqDispatch = this.dlqDispatchers.get(consumerRecord.topic());
	kafkaStreamsDlqDispatch.accept(consumerRecord, exception);
}