Skip to content
9 changes: 7 additions & 2 deletions conf/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1843,5 +1843,10 @@ brokerInterceptorsDirectory=./interceptors
# List of broker interceptor to load, which is a list of broker interceptor names
brokerInterceptors=

# Enable or disable the broker interceptor, which is only used for testing for now
disableBrokerInterceptors=true
# Enable or disable the broker interceptor.
disableBrokerInterceptors=true

# List of interceptors for entry metadata
# AppendBrokerTimestampMetadataInterceptor is enabled by default and it can make message TTL more accurate,
# but it increase 8 bytes to each message.
brokerEntryMetadataInterceptors=org.apache.pulsar.common.intercept.AppendBrokerTimestampMetadataInterceptor
5 changes: 5 additions & 0 deletions deployment/terraform-ansible/templates/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1154,3 +1154,8 @@ managedLedgerCacheEvictionFrequency=0
# Enable transaction coordinator in broker
transactionCoordinatorEnabled=true
transactionMetadataStoreProviderClassName=org.apache.pulsar.transaction.coordinator.impl.InMemTransactionMetadataStoreProvider

# List of interceptors for entry metadata
# AppendBrokerTimestampMetadataInterceptor is enabled by default and it can make message TTL more accurate,
# but it increase 8 bytes to each message.
brokerEntryMetadataInterceptors=org.apache.pulsar.common.intercept.AppendBrokerTimestampMetadataInterceptor
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -1439,8 +1438,11 @@ The delayed message index time step(in seconds) in per bucket snapshot segment,

@FieldContext(
category = CATEGORY_SERVER,
doc = "List of interceptors for entry metadata.")
private Set<String> brokerEntryMetadataInterceptors = new HashSet<>();
doc = "List of interceptors for entry metadata, "
+ "AppendBrokerTimestampMetadataInterceptor is enabled by default and it can make message "
+ "TTL more accurate, but it increase 8 bytes to each message.")
private Set<String> brokerEntryMetadataInterceptors =
Sets.newHashSet("org.apache.pulsar.common.intercept.AppendBrokerTimestampMetadataInterceptor");

@FieldContext(
category = CATEGORY_SERVER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
*/
package org.apache.pulsar.broker.service;

import static org.testng.Assert.assertEquals;
import org.apache.pulsar.broker.PulsarServerException;
import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.client.admin.internal.PulsarAdminImpl;
import org.apache.pulsar.client.impl.PulsarClientImpl;
import org.apache.pulsar.client.impl.conf.ClientConfigurationData;
Expand Down Expand Up @@ -112,4 +114,12 @@ public void testNamespaceServicePulsarClientConfiguration() {
Assert.assertEquals(clientConf.getMemoryLimitBytes(), 100000);
}

@Test
public void testEnableInterceptor() {
assertEquals(conf.getBrokerEntryMetadataInterceptors().iterator().next(),
"org.apache.pulsar.common.intercept.AppendBrokerTimestampMetadataInterceptor");
ServiceConfiguration configuration = new ServiceConfiguration();
assertEquals(configuration.getBrokerEntryMetadataInterceptors().iterator().next(),
"org.apache.pulsar.common.intercept.AppendBrokerTimestampMetadataInterceptor");
}
}