Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class ImperativeAppConfig {
private static final String TOPIC = "pulsar-inttest-topic";

@Bean
PulsarTopic pulsarTestTopic() {
return new PulsarTopicBuilder().name(TOPIC).numberOfPartitions(1).build();
PulsarTopic pulsarTestTopic(PulsarTopicBuilder topicBuilder) {
return topicBuilder.name(TOPIC).numberOfPartitions(1).build();
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class ReactiveAppConfig {
private static final String TOPIC = "pulsar-reactive-inttest-topic";

@Bean
PulsarTopic pulsarTestTopic() {
return new PulsarTopicBuilder().name(TOPIC).numberOfPartitions(1).build();
PulsarTopic pulsarTestTopic(PulsarTopicBuilder topicBuilder) {
return topicBuilder.name(TOPIC).numberOfPartitions(1).build();
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class DefaultTenantAndNamespaceTests {
static PulsarContainer PULSAR_CONTAINER = new PulsarContainer(PulsarTestContainerSupport.getPulsarImage());

@Nested
@SpringBootTest(classes = ImperativeAppConfig.class)
@SpringBootTest(classes = ImperativeAppConfig.class,
properties = { "spring.pulsar.defaults.topic.tenant=my-tenant-i",
"spring.pulsar.defaults.topic.namespace=my-namespace-i" })
@ExtendWith(OutputCaptureExtension.class)
@ActiveProfiles("inttest.pulsar.imperative")
class WithImperativeApp {
Expand All @@ -66,7 +68,9 @@ void produceConsumeWithDefaultTenantNamespace(CapturedOutput output,
}

@Nested
@SpringBootTest(classes = ReactiveAppConfig.class)
@SpringBootTest(classes = ReactiveAppConfig.class,
properties = { "spring.pulsar.defaults.topic.tenant=my-tenant-r",
"spring.pulsar.defaults.topic.namespace=my-namespace-r" })
@ExtendWith(OutputCaptureExtension.class)
@ActiveProfiles("inttest.pulsar.reactive")
class WithReactiveApp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.common.naming.TopicDomain;
import org.apache.pulsar.common.policies.data.TenantInfoImpl;

import org.springframework.boot.ApplicationRunner;
Expand Down Expand Up @@ -51,11 +50,6 @@ class ImperativeAppConfig {
static final String FQ_TOPIC = "persistent://my-tenant-i/my-namespace-i/dtant-topic-i";
static final String MSG_PREFIX = "DefaultTenantNamespace-i:";

@Bean
PulsarTopicBuilder topicBuilder() {
return new PulsarTopicBuilder(TopicDomain.persistent, TENANT, NAMESPACE);
}

@Bean
PulsarProducerFactory<Object> pulsarProducerFactory(PulsarClient pulsarClient, TopicResolver topicResolver,
PulsarTopicBuilder topicBuilder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pulsar.common.naming.TopicDomain;
import org.apache.pulsar.common.policies.data.TenantInfoImpl;
import org.apache.pulsar.reactive.client.api.ReactivePulsarClient;

Expand Down Expand Up @@ -53,11 +52,6 @@ class ReactiveAppConfig {
static final String FQ_TOPIC = "persistent://my-tenant-r/my-namespace-r/dtant-topic-r";
static final String MSG_PREFIX = "DefaultTenantNamespace-r:";

@Bean
PulsarTopicBuilder topicBuilder() {
return new PulsarTopicBuilder(TopicDomain.persistent, TENANT, NAMESPACE);
}

@Bean
ReactivePulsarSenderFactory<Object> reactivePulsarSenderFactory(ReactivePulsarClient reactivePulsarClient,
PulsarTopicBuilder topicBuilder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ The following example shows how to add `PulsarTopic` beans to let the `PulsarAdm
[source,java,indent=0,subs="verbatim"]
----
@Bean
PulsarTopic simpleTopic {
PulsarTopic simpleTopic(PulsarTopicBuilder topicBuilder) {
// This will create a non-partitioned persistent topic in the 'public/default' tenant/namespace
return new PulsarTopicBuilder().name("my-topic").build();
return topicBuilder.name("my-topic").build();
}

@Bean
PulsarTopic partitionedTopic {
PulsarTopic partitionedTopic(PulsarTopicBuilder topicBuilder) {
// This will create a persistent topic with 3 partitions in the provided tenant and namespace
return new PulsarTopicBuilder()
return topicBuilder
.name("persistent://my-tenant/my-namespace/partitioned-topic")
.numberOfPartitions(3)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ dependencies {
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
implementation 'io.zipkin.reporter2:zipkin-sender-urlconnection'
developmentOnly 'org.springframework.boot:spring-boot-docker-compose'
// TODO remove when new PulsarTopicBuilder published
implementation project(':spring-pulsar')
testImplementation project(':spring-pulsar-test')
testRuntimeOnly 'ch.qos.logback:logback-classic'
testImplementation "org.springframework.boot:spring-boot-starter-test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public static void main(String[] args) {
}

@Bean
PulsarTopic failoverDemoTopic() {
return new PulsarTopicBuilder().name(TOPIC).numberOfPartitions(3).build();
PulsarTopic failoverDemoTopic(PulsarTopicBuilder topicBuilder) {
return topicBuilder.name(TOPIC).numberOfPartitions(3).build();
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ ext['pulsar.version'] = "${pulsarVersion}"
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-pulsar'
developmentOnly 'org.springframework.boot:spring-boot-docker-compose'
// TODO remove when new PulsarTopicBuilder published
implementation project(':spring-pulsar')
implementation(testFixtures(project(":spring-pulsar")))
implementation project(':spring-pulsar-test')
testRuntimeOnly 'ch.qos.logback:logback-classic'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ static class ProduceConsumeWithPartitions {
private static final String TOPIC = "produce-consume-partitions";

@Bean
PulsarTopic partitionedTopic() {
return new PulsarTopicBuilder().name(TOPIC).numberOfPartitions(3).build();
PulsarTopic partitionedTopic(PulsarTopicBuilder topicBuilder) {
return topicBuilder.name(TOPIC).numberOfPartitions(3).build();
}

@Bean
Expand Down