Skip to main content

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.

TopicFile
Getting started (add the dependency, produce & consume)docs/getting-started.md
Architecture & three-layer modeldocs/architecture.md
Choosing dependenciesdocs/dependencies.md
Configuration reference (jeap.messaging.kafka.*)docs/configuration.md
Message types (events & commands)docs/message-types.md
Defining messages in Avrodocs/defining-messages.md
Avro Maven plugindocs/avro-maven-plugin.md
Schema evolutiondocs/message-evolution.md
Message Type Registrydocs/message-type-registry.md
Publishing messagesdocs/publishing-messages.md
Consuming messagesdocs/consuming-messages.md
Kafka how-to (integrate Kafka into a service)docs/kafka-how-to.md
Kafka topics & client configurationdocs/kafka-topics-and-configuration.md
Message contractsdocs/message-contracts.md
Idempotent message handlerdocs/idempotent-message-handler.md
Error handlingdocs/error-handling.md
Confluent Schema Registrydocs/schema-registry-confluent.md
AWS Glue Schema Registrydocs/schema-registry-aws-glue.md
AWS MSK IAM authenticationdocs/aws-msk-iam-authentication.md
Signing messagesdocs/signing-messages.md
Encrypting messagesdocs/encrypting-messages.md
Message filteringdocs/message-filtering.md
Health indicatorsdocs/health-indicators.md
Testingdocs/testing.md

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.

ModulePurpose
jeap-messaging-modelInfrastructure-independent interfaces for domain events and commands
jeap-messaging-apiMessageListener / MessagePublisher interfaces
jeap-messaging-avroAvro implementation of the model: AvroMessage, builders, AvroSerializationHelper
jeap-messaging-avro-maven-pluginGenerates Java classes from Avro schemas / the Message Type Registry
jeap-messaging-avro-compiler, -validator, -testInternal Avro compilation, validation and test support
jeap-messaging-avro-erroreventAvro types for the error-handling integration
jeap-messaging-infrastructureCore Kafka infrastructure: serialization, signing, crypto, tracing, metrics, health, error handling
jeap-messaging-infrastructure-kafkaSpring Boot auto-configuration; the main consumer-facing artifact
jeap-messaging-infrastructure-kafka-testTest fixtures: TestMessageSender, TestKafkaListener, KafkaIntegrationTestBase
jeap-messaging-infrastructure-kafka-without-tracing-testTest fixtures for services that do not use tracing
jeap-messaging-confluent-schema-registryConfluent Schema Registry integration
jeap-messaging-glue-schema-registryAWS Glue Schema Registry integration
jeap-messaging-aws-msk-iam-authAWS MSK IAM authentication
jeap-messaging-idempotence@IdempotentMessageHandler with a JPA-backed processing store and housekeeping
jeap-messaging-contract-annotationsMessage-contract annotations
jeap-messaging-contract-annotation-processorAnnotation processor generating the contract JSON uploaded during the build
jeap-messaging-contract-maven-pluginMaven plugin for message contracts
jeap-messaging-registry-maven-pluginVerifies and exports a Message Type Registry