Skip to main content

Configuration reference

All properties use the prefix jeap.messaging.kafka. Cluster-specific options live under jeap.messaging.kafka.cluster.<name>.*; for backwards compatibility most of them can also be set directly under jeap.messaging.kafka.* (this does not apply to the AWS-specific properties).

For Kafka client tuning (consumer/producer/topic) via spring.kafka.*, see Kafka topics & client configuration.

Clusters​

Since version 6, jEAP Messaging can connect to more than one Kafka cluster (mainly for hybrid-cloud use cases). Each cluster is configured under a freely chosen name. Avoid special characters, as the name is used for Spring bean names.

jeap:
messaging:
kafka:
cluster:
bit:
bootstrapServers: ...
default-cluster: true # optional; the first cluster is the default if none is marked
aws:
bootstrapServers: ...

Producers select a non-default cluster with a @Qualifier("<name>") on the injected KafkaTemplate; consumers select it with containerFactory = "<name>KafkaListenerContainerFactory" on @KafkaListener. The default cluster needs neither:

Use caseDefault clusterOther clusters (example: a cluster named aws)
Consumer@KafkaListener(topics=...)@KafkaListener(topics=..., containerFactory = "awsKafkaListenerContainerFactory")
ProducerKafkaTemplate<AvroMessageKey, AvroMessage> defaultClusterTemplate@Qualifier("aws") KafkaTemplate<AvroMessageKey, AvroMessage> awsClusterTemplate

Lombok caveat: if you inject the qualified KafkaTemplate into a Lombok-generated constructor (@AllArgsConstructor, @RequiredArgsConstructor), the @Qualifier annotation isn't copied by default and the default cluster's template may be injected regardless — see Multi-cluster caveat with Lombok for the fix.

See the jme-messaging-example repository for a multi-cluster service injecting these beans and defining listeners that produce/consume from different clusters.

NameDefaultDescription
cluster.<name>.bootstrapServerslocalhost:9092Kafka bootstrap servers (host:port)
cluster.<name>.consumerBootstrapServers—Override bootstrap servers for consumers (since 4.2.0)
cluster.<name>.producerBootstrapServers—Override bootstrap servers for producers (since 4.2.0)
cluster.<name>.adminClientBootstrapServers—Override bootstrap servers for admin clients (since 4.2.0)
cluster.<name>.default-producer-cluster-overridefalseMake this cluster the default producer cluster for migration scenarios (mirroring). Affects which KafkaTemplate and DefaultKafkaProducerFactory beans are marked @Primary

Core​

NameDefaultDescription
useSchemaRegistrytrueUse a schema registry. If false, an internal mock Confluent schema registry is used
autoRegisterSchematrueAutomatically register new schemas before first send (uses TopicRecordNameStrategy)
expose-message-key-to-consumerfalseMake message keys available to the consumer (true) or suppress them (false)
systemName—Name of the sending system; required to generate MessageProcessingFailedEvent messages
serviceName${spring.application.name}Name of the sending service; used in generated MessageProcessingFailedEvent messages
errorTopicName—Error topic for MessageProcessingFailedEvent messages (also per cluster: cluster.<name>.errorTopicName)
embedded—Force (true) or disable (false) the automatic EmbeddedKafka test configuration

Error reporting​

Properties below use jeap.messaging.kafka.*. For the error topic and sender identity, see Core. For publication and processing behavior, see Error handling.

NameDefaultDescription
errorServiceRetryIntervalMs5000Retry interval for sending a MessageProcessingFailedEvent
errorServiceRetryAttempts5Maximum retries after the initial attempt to publish a failure event; the application terminates if publication still fails.
errorEventStackTraceMaxLength7000Maximum stack-trace length in the failure event; longer traces are truncated to limit event size.
errorStackTraceHashEnabledtrueInclude a stack-trace hash for error grouping; set to false to disable it.
errorStackTraceHashDefaultExclusionPatternsSee belowReplace the built-in regular expressions for stack frames excluded from hashing.
errorStackTraceHashAdditionalExclusionPatternsEmpty listAdd exclusions to the defaults, for example ^org.springframework..* or ^ch.admin.bit.mypackage..*.

Default exclusion patterns (one Java regular expression per line):

^java.base/.*
^org.springframework.aop..*
.*\$\$FastClassByCGLIB\$\$.*
.*\$\$EnhancerBySpringCGLIB\$\$.*
.*\$\$EnhancerByCGLIB\$\$.*
.*\$\$SpringCGLIB\$\$.*

See Error stack trace hashing for the matching input and purpose.

Contracts​

NameDefaultDescription
publishWithoutContractAllowedfalseAllow producing without a contract. Must be false in production
consumeWithoutContractAllowedfalseAllow consuming without a contract. Must be false in production
silentIgnoreWithoutContractfalseSuppress only the log statement emitted when a message without a contract is received (e.g. when listening to a topic carrying several event types). Contract enforcement still applies

See Message contracts.

Encryption​

NameDefaultDescription
messageTypeEncryptionDisabledfalseDisable encryption for message types that declare an encryptionKeyId in their producer contract — useful in tests so no jEAP-Crypto instance is needed. Forbidden on acceptance and production

See Encrypting messages.

Schema registry & Kafka authentication​

For the Confluent Schema Registry with SASL authentication, the AWS Glue Schema Registry and AWS MSK IAM authentication properties, see the dedicated pages:

Overriding the deserialized type​

Since 7.2.0 (Confluent) the deserialized key/value type can be set per listener with the specific.avro.key.type / specific.avro.value.type properties. This is needed for self-messages during schema evolution:


@KafkaListener(topics = TOPIC_NAME,
properties = {"specific.avro.value.type=ch.admin.bit.jme.test.JmeSimpleTestV2Event"})
public void consume(JmeSimpleTestV2Event event, Acknowledgment ack) { ...}

Avro class whitelist​

The classes Avro trusts to be referenced from a schema are configured under jeap.messaging.avro.*, see Avro class whitelist.