problem description
how do I update a user"s attribute automatically when multiple conditions are reached in java?
the environmental background of the problems and what methods you have tried
the current implementation is to insert the code that updates the attribute where the detection of each condition occurs, so it feels like a lot of coupling, is there any way to decouple it?
now uses message queuing, too. When a condition is reached, a queue is sent to call the method to update the property.
what result do you expect? What is the error message actually seen?
have thought about using AOP, but want to know what is the common practice in the industry
pseudo-code:
@Data
class User{
private Long id;
...
private Integer level;
private Integer num1;
private Integer num2;
}
when num1 > = 50 and num2 > = 100, levelPP, it is best to add and subtract level--, num1 and num2 in two separate service, let"s call it num1Service and num2Service