diff --git a/spring-pulsar-sample-apps/sample-pulsar-binder/src/main/java/org/springframework/pulsar/sample/binder/SpringPulsarBinderSampleApp.java b/spring-pulsar-sample-apps/sample-pulsar-binder/src/main/java/org/springframework/pulsar/sample/binder/SpringPulsarBinderSampleApp.java index e79d2794..d7c4b66a 100644 --- a/spring-pulsar-sample-apps/sample-pulsar-binder/src/main/java/org/springframework/pulsar/sample/binder/SpringPulsarBinderSampleApp.java +++ b/spring-pulsar-sample-apps/sample-pulsar-binder/src/main/java/org/springframework/pulsar/sample/binder/SpringPulsarBinderSampleApp.java @@ -20,13 +20,26 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import org.apache.pulsar.client.api.Schema; +import org.apache.pulsar.common.schema.SchemaType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; +import org.springframework.pulsar.annotation.PulsarListener; +import org.springframework.pulsar.core.PulsarTemplate; +/** + * This sample binder app has an extra consumer that is equipped with Pulsar's DLT feature - timeLoggerToDlt. + * However, this consumer is not part of the spring.cloud.function.definition. + * In order to enable this, add the function timeLoggerToDlt to the definition in the application.yml file. + * When doing this, in order to minimize verbose output and just to focus on the DLT feature, comment out the + * regular supplier below (timeSupplier) and then un-comment the ApplicationRunner below. + * The runner only sends a single message whereas the supplier sends a message every second. + */ @SpringBootApplication public class SpringPulsarBinderSampleApp { @@ -41,6 +54,18 @@ public class SpringPulsarBinderSampleApp { return () -> new Time(String.valueOf(System.currentTimeMillis())); } +// @Bean +// ApplicationRunner runner(PulsarTemplate