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 case | Default cluster | Other clusters (example: a cluster named aws) |
|---|---|---|
| Consumer | @KafkaListener(topics=...) | @KafkaListener(topics=..., containerFactory = "awsKafkaListenerContainerFactory") |
| Producer | KafkaTemplate<AvroMessageKey, AvroMessage> defaultClusterTemplate | @Qualifier("aws") KafkaTemplate<AvroMessageKey, AvroMessage> awsClusterTemplate |
Lombok caveat: if you inject the qualified
KafkaTemplateinto a Lombok-generated constructor (@AllArgsConstructor,@RequiredArgsConstructor), the@Qualifierannotation 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.
| Name | Default | Description |
|---|---|---|
cluster.<name>.bootstrapServers | localhost:9092 | Kafka 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-override | false | Make this cluster the default producer cluster for migration scenarios (mirroring). Affects which KafkaTemplate and DefaultKafkaProducerFactory beans are marked @Primary |
Core
| Name | Default | Description |
|---|---|---|
useSchemaRegistry | true | Use a schema registry. If false, an internal mock Confluent schema registry is used |
autoRegisterSchema | true | Automatically register new schemas before first send (uses TopicRecordNameStrategy) |
expose-message-key-to-consumer | false | Make 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.
| Name | Default | Description |
|---|---|---|
errorServiceRetryIntervalMs | 5000 | Retry interval for sending a MessageProcessingFailedEvent |
errorServiceRetryAttempts | 5 | Maximum retries after the initial attempt to publish a failure event; the application terminates if publication still fails. |
errorEventStackTraceMaxLength | 7000 | Maximum stack-trace length in the failure event; longer traces are truncated to limit event size. |
errorStackTraceHashEnabled | true | Include a stack-trace hash for error grouping; set to false to disable it. |
errorStackTraceHashDefaultExclusionPatterns | See below | Replace the built-in regular expressions for stack frames excluded from hashing. |
errorStackTraceHashAdditionalExclusionPatterns | Empty list | Add 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
| Name | Default | Description |
|---|---|---|
publishWithoutContractAllowed | false | Allow producing without a contract. Must be false in production |
consumeWithoutContractAllowed | false | Allow consuming without a contract. Must be false in production |
silentIgnoreWithoutContract | false | Suppress 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
| Name | Default | Description |
|---|---|---|
messageTypeEncryptionDisabled | false | Disable 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.