|
|
@ -4,6 +4,7 @@ import org.apache.camel.Exchange;
|
|
|
|
import org.apache.camel.builder.RouteBuilder;
|
|
|
|
import org.apache.camel.builder.RouteBuilder;
|
|
|
|
import org.apache.camel.component.bean.validator.BeanValidationException;
|
|
|
|
import org.apache.camel.component.bean.validator.BeanValidationException;
|
|
|
|
import org.apache.camel.model.dataformat.JsonLibrary;
|
|
|
|
import org.apache.camel.model.dataformat.JsonLibrary;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
|
|
import jakarta.ws.rs.core.Response;
|
|
|
|
import jakarta.ws.rs.core.Response;
|
|
|
@ -11,6 +12,9 @@ import jakarta.ws.rs.core.Response;
|
|
|
|
@Component
|
|
|
|
@Component
|
|
|
|
public class CamelRouter extends RouteBuilder {
|
|
|
|
public class CamelRouter extends RouteBuilder {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${app.queue-name}")
|
|
|
|
|
|
|
|
private String queueName;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void configure() throws Exception {
|
|
|
|
public void configure() throws Exception {
|
|
|
|
// very raw way, just to handle the validation responses
|
|
|
|
// very raw way, just to handle the validation responses
|
|
|
@ -19,9 +23,13 @@ public class CamelRouter extends RouteBuilder {
|
|
|
|
.setBody(simple("${exchangeProperty.CamelExceptionCaught.getMessage()}"));
|
|
|
|
.setBody(simple("${exchangeProperty.CamelExceptionCaught.getMessage()}"));
|
|
|
|
|
|
|
|
|
|
|
|
from("cxfrs:/api?resourceClasses=" + UserService.class.getName() + "&bindingStyle=SimpleConsumer"
|
|
|
|
from("cxfrs:/api?resourceClasses=" + UserService.class.getName() + "&bindingStyle=SimpleConsumer"
|
|
|
|
+ "&providers=jaxrsProvider&loggingFeatureEnabled=true").to("bean-validator:user")
|
|
|
|
+ "&providers=jaxrsProvider&loggingFeatureEnabled=true").to("log:cxfrs-log?showAll=true")
|
|
|
|
.setHeader(Exchange.BEAN_METHOD_NAME, simple("${header.operationName}")).to("activemq6:queue:UserService");
|
|
|
|
.to("bean-validator:user").setHeader(Exchange.BEAN_METHOD_NAME, simple("${header.operationName}"))
|
|
|
|
from("activemq6:queue:UserService").to("log:camel-cxf-log?showAll=true").bean(UserServiceImpl.class).marshal()
|
|
|
|
.to("activemq6:queue:"+queueName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from("activemq6:queue:"+queueName).to("log:activemq6-log?showAll=true").to("disruptor:UserDisruptor");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from("disruptor:UserDisruptor").to("log:disruptor-log?showAll=true").bean(UserServiceImpl.class).marshal()
|
|
|
|
.json(JsonLibrary.Jackson);
|
|
|
|
.json(JsonLibrary.Jackson);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|