-
I have a REST POST endpoint and a GET endpoint, POST returns a The GET endpoint has a score of 100 on all three parts but my POST only has 66/100, where the Writer is 0%. I have tried to figure it out why but failed and I can't find any resources on the internet to tell me why. The GET endpoint is just there for demo and connectivity tests, the actual endpoint is the POST where I'm trying to build an API to be used by other services. The call is a This is my first attempt to build a reactive service so please be aware of newbie faults… @Path("/api")
@ApplicationScoped
public class MigrationResource {
/**
* The Camel.
*/
@Inject
CamelContext camel;
/**
* The Object factory.
*/
final ObjectFactory objectFactory = new ObjectFactory();
/**
* Migrate uni.
*
* @param requestObject the request object
* @return the uni
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
@Retry(maxRetries = 10, delay = 1, delayUnit = ChronoUnit.SECONDS)
@Timeout(250)
@CircuitBreaker(requestVolumeThreshold = 4)
@Counted(name = "performedConversions", description = "How many PISA conversions have been performed.")
@Timed(name = "checksTimer", description = "A measure of how long it takes to perform the PISA conversion.",
unit = MetricUnits.MILLISECONDS)
public Uni<Response> migrate(RequestObject requestObject) {
return Accounts.findPisaUser(requestObject.getPnr(), requestObject.getUserid())
.map(this::process)
.map(convertedPisaUser -> {
CompletableFuture<String> future = camel.createProducerTemplate()
.asyncRequestBody(
"seda:marshal?exchangePattern=InOut",
convertedPisaUser, String.class);
return camel.createProducerTemplate()
.extractFutureBody(future, String.class);
})
.onItem()
.transform(xmlString -> Response.accepted(xmlString)
.build())
.onFailure(UserMigratedException.class)
.recoverWithItem(t -> Response.status(418)
.entity(t.getMessage())
.build())
.onFailure()
.retry()
.atMost(5)
.onFailure()
.recoverWithItem(t -> Response.status(Response.Status.BAD_REQUEST)
.entity(t.getMessage())
.build());
}
/**
* Find by id uni.
*
* @param id the id
* @return the uni
*/
@GET
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Uni<Accounts> findById(Long id) {
return Accounts.findById(id);
}
/**
* Process import operation type.
*
* @param pisaUser the pisaUser
* @return the import operation type
*/
public ImportOperationType process(Accounts pisaUser) {
final AddObjectType addObjectType = objectFactory.createAddObjectType();
// CODE REMOVED FOR ABBREVIATION
return importOperationType;
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This question can be deleted, sorry for wasting time and space. |
Beta Was this translation helpful? Give feedback.
This question can be deleted, sorry for wasting time and space.
I just Googled my issue not in this forum where I found the answer. RestResponse ftw