Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for auditing #281

Closed
DVMaslov opened this issue Jan 22, 2020 · 8 comments
Closed

Add support for auditing #281

DVMaslov opened this issue Jan 22, 2020 · 8 comments
Labels
type: enhancement A general enhancement

Comments

@DVMaslov
Copy link

Entity:

@Table("orders")
public class OrdersEntity {
    @Id
    private Long id;
    private String type;
    private String description;
    @CreatedDate @Column("created_date")
    private LocalDateTime createdDate;
    private Integer amount;

   // getter setter
}

Repository:

interface OrderRepository : ReactiveCrudRepository<OrdersEntity, Long>

After repo.save(..) createdDate remains null

@mp911de mp911de changed the title Audit (@CreatedDate, @ModifiedDate, etc) not work Add support for auditing Jan 22, 2020
@mp911de mp911de added the type: enhancement A general enhancement label Jan 22, 2020
@mp911de
Copy link
Member

mp911de commented Jan 22, 2020

Thanks for your ticket. Auditing is not yet supported. We first require an entity callback/lifecycle event infrastructure, see #215.

@mp911de mp911de added the status: blocked An issue that's blocked on an external project change label Jan 22, 2020
@sheiy
Copy link

sheiy commented Apr 16, 2020

Will support be provided in the future?

@mp911de
Copy link
Member

mp911de commented Apr 16, 2020

Yes, auditing will come to Spring Data R2DBC. The reason we do not support auditing yet is that we do not have a reactive auditing infrastructure that is able to return the auditor.

@riba2101
Copy link

riba2101 commented May 20, 2020

Would it be beneficial to port auditing as is and convert to reactive at some low level?

Update:
Was checking for envers alternatives and found javers/javers#972
It is an AOP approach but for the time being lacking R2DBC support. Would this be a viable replacement for envers?

@mp911de
Copy link
Member

mp911de commented Jul 14, 2020

Depends on spring-projects/spring-data-commons#458.

@riba2101
Copy link

Btw, just a question, but wouldn't it make sense to be able to have a SQL database and be able to log audits to somewhere else like ELK?

would it make sense to create such auditing?

@mp911de
Copy link
Member

mp911de commented Jul 14, 2020

The approach sounds similar to Hibernate Envers (while envers stores revisions in the SQL database). The generic EntityCallback infrastructure that will be introduced with #215 will allow you to write revisions to any kind of target as reactive callbacks operate on a Publisher level.

@mp911de mp911de removed the status: blocked An issue that's blocked on an external project change label Jul 23, 2020
@mp911de mp911de added this to the 1.2 M2 (2020.0.0) milestone Jul 23, 2020
mp911de added a commit that referenced this issue Jul 23, 2020
We now provide auditing support that can be enabled through EnableR2dbcAuditing.

@configuration
@EnableR2dbcAuditing
class Config {

  @bean
  public ReactiveAuditorAware<String> myAuditorProvider() {
      return new AuditorAwareImpl();
  }
}
mp911de added a commit that referenced this issue Jul 23, 2020
Fix assertion messages.
@mp911de
Copy link
Member

mp911de commented Jul 23, 2020

That's in place now.

@mp911de mp911de closed this as completed Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants