jEAP Messaging
jEAP Messaging is a library for sending and receiving messages over Apache Kafka in Spring Boot applications. It builds on Spring for Apache Kafka and Avro, and lets a microservice produce and consume strongly-typed events and commands with minimal boilerplate. It provides:
- A structured definition of message types using Avro schemas and message-type descriptors
- Avro serialization of message types to Kafka records
- Pre-configured Spring Kafka beans for producers and consumers (single- and multi-cluster)
- Declaration of consumed/produced message types on topics using Java annotations (message contracts)
- Built-in error handling that never loses a message (integration with a
jeap-error-handling-service) - Idempotent message handling, message signing and encryption, and a Kafka broker health indicator
For the transactional outbox pattern see the separate jeap-messaging-outbox library.
Documentation
Start with Getting started, then follow the links below.
How-to guides
Task-oriented steps for one goal at a time.
All but the first four live under docs/how-tos/, which is also its own nested section in the site navigation.
| Task | File |
|---|---|
| Getting started (add the dependency, produce & consume) | docs/getting-started.md |
| Publishing messages | docs/publishing-messages.md |
| Consuming messages | docs/consuming-messages.md |
| Encrypting messages | docs/encrypting-messages.md |
| Integrating Kafka into a service (end-to-end checklist) | docs/how-tos/kafka-how-to.md |
| Declaring message contracts | docs/how-tos/declare-message-contracts.md |
| Updating the message type registry | docs/how-tos/update-message-type-registry.md |
| Using the idempotent message handler | docs/how-tos/use-idempotent-message-handler.md |
| Configuring error handling | docs/how-tos/configure-error-handling.md |
| Enabling message signing | docs/how-tos/enable-message-signing.md |
| Switching to AWS Glue and MSK IAM authentication | docs/how-tos/switch-to-aws-glue-and-msk-iam.md |
| Evolving a self-consumed message type | docs/how-tos/evolve-self-consumed-message-type.md |
Reference & concepts
How things work and what can be configured.
Modules
The artifact most consumers depend on is jeap-messaging-infrastructure-kafka. Group id for all
modules is ch.admin.bit.jeap; the version is managed by the jEAP Spring Boot parent.
| Module | Purpose |
|---|---|
jeap-messaging-model | Infrastructure-independent interfaces for domain events and commands |
jeap-messaging-api | MessageListener / MessagePublisher interfaces |
jeap-messaging-avro | Avro implementation of the model: AvroMessage, builders, AvroSerializationHelper |
jeap-messaging-avro-maven-plugin | Generates Java classes from Avro schemas / the Message Type Registry |
jeap-messaging-avro-compiler, -validator, -test | Internal Avro compilation, validation and test support |
jeap-messaging-avro-errorevent | Avro types for the error-handling integration |
jeap-messaging-infrastructure | Core Kafka infrastructure: serialization, signing, crypto, tracing, metrics, health, error handling |
jeap-messaging-infrastructure-kafka | Spring Boot auto-configuration; the main consumer-facing artifact |
jeap-messaging-infrastructure-kafka-test | Test fixtures: TestMessageSender, TestKafkaListener, KafkaIntegrationTestBase |
jeap-messaging-infrastructure-kafka-without-tracing-test | Test fixtures for services that do not use tracing |
jeap-messaging-confluent-schema-registry | Confluent Schema Registry integration |
jeap-messaging-glue-schema-registry | AWS Glue Schema Registry integration |
jeap-messaging-aws-msk-iam-auth | AWS MSK IAM authentication |
jeap-messaging-idempotence | @IdempotentMessageHandler with a JPA-backed processing store and housekeeping |
jeap-messaging-contract-annotations | Message-contract annotations |
jeap-messaging-contract-annotation-processor | Annotation processor generating the contract JSON uploaded during the build |
jeap-messaging-contract-maven-plugin | Maven plugin for message contracts |
jeap-messaging-registry-maven-plugin | Verifies and exports a Message Type Registry |