vidakovic commented on code in PR #5622:
URL: https://github.com/apache/fineract/pull/5622#discussion_r3004074137


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/handler/CreateProductMixCommandHandler.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 = "CREATE")
-public class CreateProductMixCommandHandler implements NewCommandSourceHandler 
{
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class CreateProductMixCommandHandler implements 
CommandHandler<ProductMixCommandRequest, CommandProcessingResult> {
 
-    private final ProductMixWritePlatformService 
productMixWritePlatformService;
+    private final ProductMixWritePlatformService writePlatformService;
 
-    @Autowired
-    public CreateProductMixCommandHandler(final ProductMixWritePlatformService 
productMixWritePlatformService) {
-
-        this.productMixWritePlatformService = productMixWritePlatformService;
+    @Retry(name = "commandCreateProductMix", fallbackMethod = "fallback")
+    @Override
+    @Transactional
+    public CommandProcessingResult handle(Command<ProductMixCommandRequest> 
command) {

Review Comment:
   `CommandProcessingResult` belongs to the legacy command processing 
mechanics. Besides that it's just a thin wrapper around a basically type-less 
JSON string blob, not what we intend to do here. The type here should be 
`ProductMixCreateResponse`.
   
   Also: name of this handler class should be `ProductMixCreateCommandHandler`.



-- 
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]

Reply via email to