0 Replies Latest reply on Oct 2, 2014 5:11 AM by mfernandezmartinez

    Camel tracer in Switchyard Project

    mfernandezmartinez

      Hi!

       

      Following this documentation and example: https://camel.apache.org/tracer.html // https://camel.apache.org/tracer-example.html I'm trying to add a tracer to my project. With this approach I try to store each message exchange in the "CAMEL_MESSAGETRACED" table in the database.

      The compilation proccess doesn't throw any errors and the deployment and execution are also ok. However, nothing is inserted in the DB. What am I doing wrong? Should I add something to switchyard.xml?

       

      Thank you!

       

      Camel Java Implementation:

      public void configure() {

       

            Tracer tracer = new Tracer();

            tracer.setTraceOutExchanges(true);

            tracer.setUseJpa(true);

            tracer.setEnabled(true);

            tracer.setTraceInterceptors(true);

       

        DefaultTraceFormatter formatter = new DefaultTraceFormatter();

        formatter.setShowOutBody(true);

        formatter.setShowOutBodyType(true);

        

        tracer.setFormatter(formatter);

        getContext().setTracing(true);

        getContext().addInterceptStrategy(tracer);

       

        org.apache.camel.Processor myProc = new org.apache.camel.Processor() {

        public void process(org.apache.camel.Exchange exchange)

        throws Exception {

        String body = exchange.getIn().getBody(String.class);

        exchange.getOut().setBody(body);

        exchange.getOut().setHeaders(exchange.getIn().getHeaders());

        }

        };

       

        from("switchyard://ProxyService").process(myProc)

        .log("${body}").to("switchyard://ProxifiedService").end();

        }

       

      persistence.xml

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">

       

       

        <persistence-unit name="tracer" transaction-type="RESOURCE_LOCAL">

        <provider>org.hibernate.ejb.HibernatePersistence</provider>

        <class>org.apache.camel.processor.interceptor.jpa.JpaTraceEventMessage

        </class>

       

       

        <properties>

       

       

        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />

        <property name="hibernate.connection.datasource" value="java:jboss/datasources/myds" />

       

       

        <property name="hibernate.hbm2ddl.auto" value="create" />

       

       

        <!-- debugging flags -->

        <property name="hibernate.show_sql" value="true" />

        <property name="hibernate.format_sql" value="true" />

        </properties>

       

       

        </persistence-unit>

      </persistence>

       

      JBoss Log:

      11:06:22,162 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "ApplicationService-0.0.1-SNAPSHOT.jar" (runtime-name: "ApplicationService-0.0.1-SNAPSHOT.jar")

      11:06:22,192 INFO  [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for tracer

      11:06:22,206 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016002: Processing weld deployment ApplicationService-0.0.1-SNAPSHOT.jar

      11:06:22,228 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: ApplicationService-0.0.1-SNAPSHOT.jar

      11:06:22,230 INFO  [org.switchyard] (MSC service thread 1-1) Deploying SwitchYard application 'ApplicationService-0.0.1-SNAPSHOT.jar'

      11:06:22,233 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 98) JBAS011402: Starting Persistence Unit Service 'ApplicationService-0.0.1-SNAPSHOT.jar#tracer'

      11:06:22,233 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016008: Starting weld service for deployment ApplicationService-0.0.1-SNAPSHOT.jar

      11:06:22,352 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 98) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect

      11:06:22,404 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (ServerService Thread Pool -- 98) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

      11:06:22,406 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 98) HHH000397: Using ASTQueryTranslatorFactory

      11:06:22,487 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 98) HHH000227: Running hbm2ddl schema export

      11:06:22,490 INFO  [stdout] (ServerService Thread Pool -- 98) Hibernate:

      11:06:22,490 INFO  [stdout] (ServerService Thread Pool -- 98)     drop table CAMEL_MESSAGETRACED cascade constraints

      11:06:22,750 INFO  [stdout] (ServerService Thread Pool -- 98) Hibernate:

      11:06:22,750 INFO  [stdout] (ServerService Thread Pool -- 98)     drop sequence hibernate_sequence

      11:06:22,785 INFO  [stdout] (ServerService Thread Pool -- 98) Hibernate:

      11:06:22,785 INFO  [stdout] (ServerService Thread Pool -- 98)     create table CAMEL_MESSAGETRACED (

      11:06:22,786 INFO  [stdout] (ServerService Thread Pool -- 98)         id number(19,0) not null,

      11:06:22,786 INFO  [stdout] (ServerService Thread Pool -- 98)         body clob,

      11:06:22,786 INFO  [stdout] (ServerService Thread Pool -- 98)         bodyType varchar2(255 char),

      11:06:22,786 INFO  [stdout] (ServerService Thread Pool -- 98)         causedByException clob,

      11:06:22,786 INFO  [stdout] (ServerService Thread Pool -- 98)         exchangeId varchar2(255 char),

      11:06:22,787 INFO  [stdout] (ServerService Thread Pool -- 98)         exchangePattern varchar2(255 char),

      11:06:22,787 INFO  [stdout] (ServerService Thread Pool -- 98)         fromEndpointUri varchar2(255 char),

      11:06:22,787 INFO  [stdout] (ServerService Thread Pool -- 98)         headers clob,

      11:06:22,787 INFO  [stdout] (ServerService Thread Pool -- 98)         outBody clob,

      11:06:22,787 INFO  [stdout] (ServerService Thread Pool -- 98)         outBodyType varchar2(255 char),

      11:06:22,787 INFO  [stdout] (ServerService Thread Pool -- 98)         outHeaders clob,

      11:06:22,788 INFO  [stdout] (ServerService Thread Pool -- 98)         previousNode varchar2(255 char),

      11:06:22,788 INFO  [stdout] (ServerService Thread Pool -- 98)         properties clob,

      11:06:22,788 INFO  [stdout] (ServerService Thread Pool -- 98)         routeId varchar2(255 char),

      11:06:22,789 INFO  [stdout] (ServerService Thread Pool -- 98)         shortExchangeId varchar2(255 char),

      11:06:22,789 INFO  [stdout] (ServerService Thread Pool -- 98)         timestamp timestamp,

      11:06:22,789 INFO  [stdout] (ServerService Thread Pool -- 98)         toNode varchar2(255 char),

      11:06:22,789 INFO  [stdout] (ServerService Thread Pool -- 98)         primary key (id)

      11:06:22,790 INFO  [stdout] (ServerService Thread Pool -- 98)     )

      11:06:22,948 INFO  [stdout] (ServerService Thread Pool -- 98) Hibernate:

      11:06:22,948 INFO  [stdout] (ServerService Thread Pool -- 98)     create sequence hibernate_sequence start with 1 increment by 1

      11:06:22,982 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 98) HHH000230: Schema export complete

      11:06:22,983 WARN  [org.hibernate.internal.SessionFactoryImpl] (ServerService Thread Pool -- 98) HHH000008: JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()

      11:06:23,044 INFO  [org.switchyard] (MSC service thread 1-1) Starting SwitchYard service

      11:06:23,065 INFO  [org.apache.camel.management.ManagementStrategyFactory] (MSC service thread 1-1) JMX enabled.

      11:06:23,065 INFO  [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-1) Apache Camel 1.1.0.Final (CamelContext: camel-10) is starting

      11:06:23,066 INFO  [org.apache.camel.management.DefaultManagementLifecycleStrategy] (MSC service thread 1-1) StatisticsLevel at All so enabling load performance statistics

      11:06:23,077 INFO  [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service thread 1-1) Loaded 179 type converters

      11:06:23,081 INFO  [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-1) Total 0 routes, of which 0 is started.

      11:06:23,082 INFO  [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-1) Apache Camel 1.1.0.Final (CamelContext: camel-10) started in 0.016 seconds

      11:06:23,172 INFO  [org.switchyard.component.soap] (MSC service thread 1-1) SWITCHYARD035014: Creating dispatch with WSDL vfs:/C:/mycompany/EntornoDesarrollo/newEA/jboss-eap-6.1/bin/content/ApplicationService-0.0.1-SNAPSHOT.jar/META-INF/ApplicationWS.wsdl

      11:06:23,345 INFO  [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-1) Route: direct:{urn:com.mycompany.ea.application:ApplicationService:1.0}ProxyService/ProxifiedService started and consuming from: Endpoint[direct://%7Burn:com.mycompany.ea.application:ApplicationService:1.0%7DProxyService/ProxifiedService]

      11:06:23,382 INFO  [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-1) Route: route5 started and consuming from: Endpoint[switchyard://ProxyService]

      11:06:23,546 INFO  [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-1) Route: direct:{urn:com.mycompany.ea.application:ApplicationService:1.0}PromotedProxyService started and consuming from: Endpoint[direct://%7Burn:com.mycompany.ea.application:ApplicationService:1.0%7DPromotedProxyService]

      11:06:23,552 INFO  [org.switchyard] (MSC service thread 1-1) Addressing [enabled = false, required = false]

      11:06:23,553 INFO  [org.switchyard] (MSC service thread 1-1) MTOM [enabled = false, threshold = 0]

      11:06:23,556 INFO  [org.jboss.ws.cxf.metadata] (MSC service thread 1-1) JBWS024061: Adding service endpoint metadata: id=ApplicationWSService

      address=http://localhost:8080/ApplicationService/ApplicationWSService

      implementor=org.switchyard.component.soap.endpoint.BaseWebService

      serviceName={http://service.admin.ws.mycompany.com/}ApplicationWSService

      portName={http://service.admin.ws.mycompany.com/}ApplicationWSPort

      annotationWsdlLocation=null

      wsdlLocationOverride=vfs:/C:/mycompany/EntornoDesarrollo/newEA/jboss-eap-6.1/bin/content/ApplicationService-0.0.1-SNAPSHOT.jar/META-INF/ApplicationWS.wsdl

      mtomEnabled=false

      handlers=[org.switchyard.component.soap.InboundResponseHandler]

      publishedEndpointUrl=http://localhost:8080/ApplicationService/ApplicationWSService

      invoker=org.jboss.wsf.stack.cxf.JBossWSInvoker

      properties=[org.jboss.as.webservices.metadata.modelComponentViewName -> null]

      11:06:23,605 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-1) Creating Service {http://service.admin.ws.mycompany.com/}ApplicationWSService from WSDL: vfs:/C:/mycompany/EntornoDesarrollo/newEA/jboss-eap-6.1/bin/content/ApplicationService-0.0.1-SNAPSHOT.jar/META-INF/ApplicationWS.wsdl

      11:06:23,617 INFO  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-1) Setting the server's publish address to be http://localhost:8080/ApplicationService/ApplicationWSService

      11:06:23,640 INFO  [org.jboss.ws.cxf.deployment] (MSC service thread 1-1) JBWS024074: WSDL published to: file:/C:/mycompany/EntornoDesarrollo/newEA/jboss-eap-6.1/standalone/data/wsdl/ApplicationService.deployment/ApplicationWSService.wsdl

      11:06:23,642 INFO  [org.jboss.as.webservices] (MSC service thread 1-2) JBAS015539: Starting service jboss.ws.port-component-link

      11:06:23,642 INFO  [org.jboss.as.webservices] (MSC service thread 1-2) JBAS015539: Starting service jboss.ws.endpoint."ApplicationService.deployment".ApplicationWSService

      11:06:23,652 ERROR [org.jboss.as.webservices] (MSC service thread 1-2) JBAS015591: Cannot register record processor with JMX server

      11:06:23,653 ERROR [org.jboss.as.webservices] (MSC service thread 1-2) JBAS015591: Cannot register record processor with JMX server

      11:06:23,655 INFO  [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022050: Endpoint registered: jboss.ws:context=ApplicationService,endpoint=ApplicationWSService

      11:06:23,689 INFO  [org.jboss.as.server] (HttpManagementService-threads - 3) JBAS018559: Deployed "ApplicationService-0.0.1-SNAPSHOT.jar" (runtime-name : "ApplicationService-0.0.1-SNAPSHOT.jar")

      11:08:32,394 INFO  [route5] (http-/127.0.0.1:8080-1) <ser:readApplications xmlns:ser="http://service.admin.ws.mycompany.com/">

               <!--Optional:-->

               <application>

               </application>

            </ser:readApplications>