vidakovic commented on code in PR #5622:
URL: https://github.com/apache/fineract/pull/5622#discussion_r3004075904
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/handler/UpdateProductMixCommandHandler.java:
##########
@@ -18,32 +18,33 @@
*/
package org.apache.fineract.portfolio.loanproduct.productmix.handler;
-import org.apache.fineract.commands.annotation.CommandType;
-import org.apache.fineract.commands.handler.NewCommandSourceHandler;
-import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import io.github.resilience4j.retry.annotation.Retry;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.command.core.Command;
+import org.apache.fineract.command.core.CommandHandler;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import
org.apache.fineract.portfolio.loanproduct.productmix.data.ProductMixCommandRequest;
import
org.apache.fineract.portfolio.loanproduct.productmix.service.ProductMixWritePlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
+import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-@Service
-@CommandType(entity = "PRODUCTMIX", action = "UPDATE")
-public class UpdateProductMixCommandHandler implements NewCommandSourceHandler
{
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class UpdateProductMixCommandHandler implements
CommandHandler<ProductMixCommandRequest, CommandProcessingResult> {
- private final ProductMixWritePlatformService
productMixWritePlatformService;
+ private final ProductMixWritePlatformService writePlatformService;
- @Autowired
- public UpdateProductMixCommandHandler(final ProductMixWritePlatformService
productMixWritePlatformService) {
-
- this.productMixWritePlatformService = productMixWritePlatformService;
+ @Retry(name = "commandUpdateProductMix", fallbackMethod = "fallback")
+ @Override
+ @Transactional
+ public CommandProcessingResult handle(Command<ProductMixCommandRequest>
command) {
+ return writePlatformService.updateProductMix(command.getPayload());
}
- @Transactional
@Override
- public CommandProcessingResult processCommand(final JsonCommand command) {
-
- return
this.productMixWritePlatformService.updateProductMix(command.getProductId(),
command);
+ public CommandProcessingResult fallback(Command<ProductMixCommandRequest>
command, Throwable t) {
Review Comment:
Return type conventions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]