Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
eolivelli committed Apr 11, 2024
1 parent 061629b commit 5409723
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ public class JMSPublishFilters implements BrokerInterceptor {
private boolean enabled = false;

@Override
public void initialize(PulsarService pulsarService) throws Exception {
public void initialize(PulsarService pulsarService) {
enabled =
Boolean.parseBoolean(
pulsarService.getConfiguration().getProperty("jmsApplyFiltersOnPublish") + "");
pulsarService
.getConfiguration()
.getProperties()
.getProperty("jmsApplyFiltersOnPublish", "true"));
log.info("jmsApplyFiltersOnPublish={}", enabled);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public class JMSPublishFiltersTest {
.withEnv("PULSAR_PREFIX_transactionCoordinatorEnabled", "false")
.withEnv("PULSAR_PREFIX_brokerInterceptorsDirectory", "/pulsar/interceptors")
.withEnv("PULSAR_PREFIX_brokerInterceptors", "jms-publish-filters")
.withEnv("PULSAR_LOG_LEVEL", "info");
.withEnv("PULSAR_PREFIX_jmsApplyFiltersOnPublish", "true")
.withLogContainerOutput(true);

private Map<String, Object> buildProperties() {
Map<String, Object> properties = pulsarContainer.buildJMSConnectionProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class PulsarContainerExtension implements BeforeAllCallback, AfterAllCall
private Network network;

private PulsarAdmin admin;
private boolean logContainerOutput = false;

public PulsarContainerExtension() {
env.put("PULSAR_PREFIX_acknowledgmentAtBatchIndexLevelEnabled", "true");
Expand Down Expand Up @@ -85,7 +86,11 @@ public void beforeAll(ExtensionContext extensionContext) {
if (text.contains("messaging service is ready")) {
pulsarReady.countDown();
}
log.info(text);
if (logContainerOutput) {
log.info(text);
} else {
log.debug(text);
}
})
.withCopyFileToContainer(
MountableFile.forHostPath("target/classes/filters"), "/pulsar/filters")
Expand All @@ -109,6 +114,11 @@ public PulsarContainerExtension withOnContainerReady(
return this;
}

public PulsarContainerExtension withLogContainerOutput(boolean logContainerOutput) {
this.logContainerOutput = logContainerOutput;
return this;
}

public PulsarContainerExtension withEnv(String key, String value) {
this.env.put(key, value);
return this;
Expand Down

0 comments on commit 5409723

Please sign in to comment.