Commit 75bcbd2c authored by sgandhi@nisum.com's avatar sgandhi@nisum.com

EPE-006 : added feign client for end of transaction call.

parent 7140b2c2
package com.nisum.offertransactionservice.client;
import com.nisum.offertransactionservice.dto.PERequest;
import com.nisum.offertransactionservice.dto.PEResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
@FeignClient(name = "${storeproducer.application.name}")
public interface StoreProducerFeignClient {
@PostMapping(value = "${endpoint.url.storeProducerUrl}")
ResponseEntity<String> callStoreProducer(String transactionId);
}
package com.nisum.offertransactionservice.service; package com.nisum.offertransactionservice.service;
import com.nisum.offertransactionservice.client.ClientService; import com.nisum.offertransactionservice.client.ClientService;
import com.nisum.offertransactionservice.client.StoreProducerFeignClient;
import com.nisum.offertransactionservice.genericexception.GlobalApiGenericException; import com.nisum.offertransactionservice.genericexception.GlobalApiGenericException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.PropertySource;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
...@@ -19,7 +21,7 @@ import java.util.Objects; ...@@ -19,7 +21,7 @@ import java.util.Objects;
public class EndOfTransactionService { public class EndOfTransactionService {
@Autowired @Autowired
ClientService clientService; private StoreProducerFeignClient storeProducerFeignClient;
public String endOfTransaction(String uuid) { public String endOfTransaction(String uuid) {
if (Objects.isNull(uuid) || uuid.isEmpty()) { if (Objects.isNull(uuid) || uuid.isEmpty()) {
...@@ -27,9 +29,9 @@ public class EndOfTransactionService { ...@@ -27,9 +29,9 @@ public class EndOfTransactionService {
throw new GlobalApiGenericException("Unable to get the Offer transaction uuid ", new Exception("exception e"), "400", false); throw new GlobalApiGenericException("Unable to get the Offer transaction uuid ", new Exception("exception e"), "400", false);
} }
log.info("Store Consumer WebClient call Start"); log.info("Store Consumer WebClient call Start");
Mono<String> endOfTransactionRes = clientService.getStringMono(uuid); ResponseEntity<String> endOfTransactionRes = storeProducerFeignClient.callStoreProducer(uuid);
log.debug("Store consumer WebClient call End"); log.debug("Store consumer WebClient call End");
return endOfTransactionRes.toString(); return endOfTransactionRes.getBody();
} }
......
...@@ -3,6 +3,7 @@ spring.datasource.username=postgres ...@@ -3,6 +3,7 @@ spring.datasource.username=postgres
spring.datasource.password=dbpwd spring.datasource.password=dbpwd
endpoint.url.promotionEngineUrl=/promotionEngine/calculateDiscount endpoint.url.promotionEngineUrl=/promotionEngine/calculateDiscount
pe.application.name=pe pe.application.name=pe
storeproducer.application.name=storeproducer
endpoint.url.storeProducerUrl=/store/producer endpoint.url.storeProducerUrl=/store/producer
endpoint.url.spBaseUrl=http://localhost:7070 endpoint.url.spBaseUrl=http://localhost:7070
server.port = 7072 server.port = 7072
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment