From e9ff405a04d9ec26847bf50dcdf0929b23812943 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Fri, 16 Jun 2023 19:21:25 -0400 Subject: [PATCH] Initial migration of Pulsar binder docs From https://github.com/spring-projects/spring-pulsar/blob/0.2.x/spring-pulsar-docs/src/main/asciidoc/pulsar-binder.adoc --- docs/src/main/asciidoc/index.adoc | 1 + .../main/asciidoc/pulsar/pulsar-binder.adoc | 262 ++++++++++++++++++ .../spring-cloud-stream-binder-pulsar.adoc | 40 +++ 3 files changed, 303 insertions(+) create mode 100644 docs/src/main/asciidoc/pulsar/pulsar-binder.adoc create mode 100644 docs/src/main/asciidoc/pulsar/spring-cloud-stream-binder-pulsar.adoc diff --git a/docs/src/main/asciidoc/index.adoc b/docs/src/main/asciidoc/index.adoc index 16a80b75e..8787e9f66 100644 --- a/docs/src/main/asciidoc/index.adoc +++ b/docs/src/main/asciidoc/index.adoc @@ -13,6 +13,7 @@ The reference documentation consists of the following sections: <> :: Spring Cloud Stream binder reference for Rabbit MQ <> :: Spring Cloud Stream binder reference for Apache Kafka <> :: Spring Cloud Stream binder reference for Apache Kafka Streams +<> :: Spring Cloud Stream binder reference for Apache Pulsar https://github.com/SolaceProducts/solace-spring-cloud/tree/master/solace-spring-cloud-starters/solace-spring-cloud-stream-starter#spring-cloud-stream-binder-for-solace-pubsub[Solace PubSub+ Binder] :: Spring Cloud Stream binder reference for Solace PubSub+ (Partner Maintained) <> :: A collection of Partner maintained binder implementations for Spring Cloud Stream (e.g., Azure Event Hubs, Google PubSub, Solace PubSub+) diff --git a/docs/src/main/asciidoc/pulsar/pulsar-binder.adoc b/docs/src/main/asciidoc/pulsar/pulsar-binder.adoc new file mode 100644 index 000000000..420dd6bd0 --- /dev/null +++ b/docs/src/main/asciidoc/pulsar/pulsar-binder.adoc @@ -0,0 +1,262 @@ +[[pulsar-binder]] += Spring Cloud Stream Binder for Apache Pulsar +include::attributes.adoc[] + +Spring for Apache Pulsar provides a binder for Spring Cloud Stream that we can use to build event-driven microservices using pub-sub paradigms. +In this section, we will go through the basic details of this binder. + +TIP: For those unfamiliar with the concepts in Spring Cloud Stream, go through the primary {spring-cloud-stream-docs}[reference docs] for Spring Cloud Stream to understand the core concepts. + +== Usage + +We need to include the following dependency on your application to use Apache Pulsar binder for Spring Cloud Stream. + +[source,xml,indent=0,subs="verbatim,attributes",role="primary"] +.Maven +---- + + + org.springframework.pulsar + spring-pulsar-spring-cloud-stream-binder + {spring-pulsar-version} + + +---- + +[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] +.Gradle +---- +dependencies { + implementation 'org.springframework.pulsar:spring-pulsar-spring-cloud-stream-binder:{spring-pulsar-version}' +} +---- + +== Overview + +The Spring Cloud Stream binder for Apache Pulsar allows the applications to focus on business logic rather than dealing with the lower-level details of managing and maintaining Pulsar. +The binder takes care of all those details for the application developer. +Spring Cloud Stream brings a powerful programming model based on {spring-cloud-function}[Spring Cloud Function] that allows the app developer to write complex event-driven applications using a functional style. +Applications can start from a middleware-neutral manner and then map Pulsar topics as destinations in Spring Cloud Stream through Spring Boot configuration properties. +Spring Cloud Stream is built on top of Spring Boot, and when writing an event-driven microservice using Spring Cloud Stream, you are essentially writing a Boot application. +Here is a straightforward Spring Cloud Stream application. + +==== +[source, java] +---- +@SpringBootApplication +public class SpringPulsarBinderSampleApp { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + public static void main(String[] args) { + SpringApplication.run(SpringPulsarBinderSampleApp.class, args); + } + + @Bean + public Supplier