Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added Spring XML-Configuration

...

Code Block
JAXRSClientFactoryBean clientFactory = new JAXRSClientFactoryBean();
clientFactory.setAddress("http://localhost:9001/");
clientFactory.setServiceClass(FooService.class);
clientFactory.getFeatures().add(new BraveClientFeature(brave));
FooService client = (FooService) clientFactory.create();

 

...

Spring XML-Configuration

If your project uses classic Spring XML-Configuration, you should consider using brave-spring-beans. The factory beans allow to create the config like this:

Code Block
languagexml
<bean id="braveFeature" class="org.apache.cxf.tracing.brave.BraveFeature"><!-- JAX-WS server feature -->
   <constructor-arg ref="httpTracing" />
</bean>

<bean id="httpTracing" class="brave.spring.beans.HttpTracingFactoryBean">
   <property name="tracing">
      <bean class="brave.spring.beans.TracingFactoryBean">
         <property name="localServiceName" value="myService"/>
         <property name="reporter">
            <bean class="brave.spring.beans.AsyncReporterFactoryBean">
               <property name="sender">
                  <bean class="zipkin.reporter.urlconnection.URLConnectionSender" factory-method="create">
                     <constructor-arg value="http://localhost:9411/api/v1/spans"/>
                  </bean>
               </property>
            </bean>
         </property>
         <property name="currentTraceContext">
            <bean class="brave.context.slf4j.MDCCurrentTraceContext" factory-method="create"/>
         </property>
      </bean>
   </property>
   <property name="clientParser">
      <bean class="org.apache.cxf.tracing.brave.HttpClientSpanParser" />
   </property>
   <property name="serverParser">
      <bean class="org.apache.cxf.tracing.brave.HttpServerSpanParser" />
   </property>
</bean>