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;
import com.nisum.offertransactionservice.client.ClientService;
import com.nisum.offertransactionservice.client.StoreProducerFeignClient;
import com.nisum.offertransactionservice.genericexception.GlobalApiGenericException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
......@@ -19,7 +21,7 @@ import java.util.Objects;
public class EndOfTransactionService {
@Autowired
ClientService clientService;
private StoreProducerFeignClient storeProducerFeignClient;
public String endOfTransaction(String uuid) {
if (Objects.isNull(uuid) || uuid.isEmpty()) {
......@@ -27,9 +29,9 @@ public class EndOfTransactionService {
throw new GlobalApiGenericException("Unable to get the Offer transaction uuid ", new Exception("exception e"), "400", false);
}
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");
return endOfTransactionRes.toString();
return endOfTransactionRes.getBody();
}
......
......@@ -3,6 +3,7 @@ spring.datasource.username=postgres
spring.datasource.password=dbpwd
endpoint.url.promotionEngineUrl=/promotionEngine/calculateDiscount
pe.application.name=pe
storeproducer.application.name=storeproducer
endpoint.url.storeProducerUrl=/store/producer
endpoint.url.spBaseUrl=http://localhost:7070
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