|
@ -1,15 +1,11 @@
|
|
package com.yihu.hos.broker.services.camel;
|
|
package com.yihu.hos.broker.services.camel;
|
|
|
|
|
|
import com.yihu.hos.broker.common.log.TracerFormatter;
|
|
|
|
import com.yihu.hos.broker.services.BrokerServerService;
|
|
import com.yihu.hos.broker.services.BrokerServerService;
|
|
import com.yihu.hos.broker.util.lang.DynamicClassLoader;
|
|
import com.yihu.hos.broker.util.lang.DynamicClassLoader;
|
|
import com.yihu.hos.core.log.Logger;
|
|
import com.yihu.hos.core.log.Logger;
|
|
import com.yihu.hos.core.log.LoggerFactory;
|
|
import com.yihu.hos.core.log.LoggerFactory;
|
|
import org.apache.camel.CamelContext;
|
|
import org.apache.camel.CamelContext;
|
|
import org.apache.camel.Exchange;
|
|
|
|
import org.apache.camel.builder.RouteBuilder;
|
|
import org.apache.camel.builder.RouteBuilder;
|
|
import org.apache.camel.processor.interceptor.DefaultTraceFormatter;
|
|
|
|
import org.apache.camel.processor.interceptor.Tracer;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
|
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@ -39,25 +35,25 @@ public class CamelStartBoot {
|
|
logger.info("Apache Camel Context 启动...");
|
|
logger.info("Apache Camel Context 启动...");
|
|
|
|
|
|
try {
|
|
try {
|
|
context.setStreamCaching(true); //确保outBody可以消费多次。参考链接:http://camel.apache.org/why-is-my-message-body-empty.html
|
|
|
|
|
|
// context.setStreamCaching(true); //确保outBody可以消费多次。参考链接:http://camel.apache.org/why-is-my-message-body-empty.html
|
|
context.setUseMDCLogging(true);
|
|
context.setUseMDCLogging(true);
|
|
|
|
|
|
Tracer tracer = new Tracer();
|
|
|
|
tracer.setTraceOutExchanges(true);
|
|
|
|
|
|
// Tracer tracer = new Tracer();
|
|
|
|
// tracer.setTraceOutExchanges(true);
|
|
|
|
|
|
DefaultTraceFormatter formatter = new TracerFormatter();
|
|
|
|
formatter.setShowHeaders(true);
|
|
|
|
formatter.setShowBody(true);
|
|
|
|
formatter.setShowBodyType(true);
|
|
|
|
formatter.setShowOutHeaders(true);
|
|
|
|
formatter.setShowOutBody(true);
|
|
|
|
formatter.setShowOutBodyType(true);
|
|
|
|
tracer.setFormatter(formatter);
|
|
|
|
|
|
// DefaultTraceFormatter formatter = new TracerFormatter();
|
|
|
|
// formatter.setShowHeaders(true);
|
|
|
|
// formatter.setShowBody(true);
|
|
|
|
// formatter.setShowBodyType(true);
|
|
|
|
// formatter.setShowOutHeaders(true);
|
|
|
|
// formatter.setShowOutBody(true);
|
|
|
|
// formatter.setShowOutBodyType(true);
|
|
|
|
// tracer.setFormatter(formatter);
|
|
|
|
|
|
context.addInterceptStrategy(tracer);
|
|
|
|
context.setTracing(true);
|
|
|
|
|
|
// context.addInterceptStrategy(tracer);
|
|
|
|
// context.setTracing(true);
|
|
|
|
|
|
context.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_STREAMS, "true");
|
|
|
|
|
|
// context.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_STREAMS, "true");
|
|
|
|
|
|
context.start();
|
|
context.start();
|
|
logger.info("Apache Camel Context 启动完成...");
|
|
logger.info("Apache Camel Context 启动完成...");
|