Skip to content

theodo-fintech/spring-data-event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stargazers Issues

Spring Data Event

Features

  • Data Event Entity: Set up your JPA Entities to be automatically sent over Kafka topics when saved, updated or deleted simply using @DataEventEntity

More to come later... Stay tuned !

Getting Started

Prerequisites

This library has been currently tested on projects under SpringBoot on version 3.2.4 with Java 17 or later, using Hibernate as a JPA implementation.

Installation

You will have to add the dependency in your spring-boot-project

<dependency>
    <groupId>com.sipios</groupId>
    <artifactId>spring-data-event</artifactId>
    <version>0.1.0</version>
</dependency>

Configuration

Set up your application properties file to make spring kafka work properly

spring.kafka.bootstrap-servers=localhost:29092

Then, you will have to enable the library so that it will be able to work properly. You just add the @EnableDataEvent on any of your @Configuration class already existing on your project, or directly on the @SpringBootApplication class.

Usage

To mark a JPA entity to be automatically sent over event platform, put the @DataEventEntity on your entity

For instance

@Entity
@DataEventEntity
@Table(name= "user_account")
public class UserEntity {

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.UUID)
    private UUID id;


}

By default, the topics on which the event will be sent are :

  • For the creation : entity_name.created (for example : userentity.created)
  • For the update : entity_name.updated (for example : userentity.updated)
  • For the deletion : entity_name.deleted (for example : userentity.deleted)

FAQs

No FAQ at the moment

Roadmap

  • Add simple case of sending creation, update and deletion event over kafka
  • Allow customizing which events should be sent or not
  • Allow customizing which attribute from the entity to be sent or not
  • Allow other event techno as RabbitMQ or Apache Pulsar

Contributing

We are just getting started on this project and would highly appreciate contributions

License

Distributed under the MIT License. See LICENSE for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages