Modified:
websites/production/cxf/content/docs/using-cxf-and-cdi-1112-jsr-346-in-osgi-environment.html
==============================================================================
---
websites/production/cxf/content/docs/using-cxf-and-cdi-1112-jsr-346-in-osgi-environment.html
(original)
+++
websites/production/cxf/content/docs/using-cxf-and-cdi-1112-jsr-346-in-osgi-environment.html
Wed Sep 13 15:05:52 2017
@@ -124,7 +124,7 @@ Apache CXF -- Using CXF and CDI 1.1/1.2
<pre>feature:repo-add cxf 3.1.0
feature:install cxf/3.1.0 cxf-jaxrs-cdi/3.1.0</pre>
</div></div><h1
id="UsingCXFandCDI1.1/1.2(JSR-346)inOSGienvironment-BundleMetadata">Bundle
Metadata</h1><p>In order for the bundle to be recognized as web CDI one and use
Apache CXF CDI capabilities, it should provide special bundle manifest
instructions (f.e. by  using <strong>maven-bundle-plugin</strong>
plugin).</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"></instructions>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"></instructions>
...
<Import-Package>
javax.servlet;version="[2.6,4)",
@@ -141,7 +141,7 @@ feature:install cxf/3.1.0 cxf-jaxrs-cdi/
<_wab>src/main/webapp</_wab>
</instructions></pre>
</div></div><p>The <strong>Require-Capability</strong> instruction is very
important in order for CDI initialization, discovery and injections to work
with Apache CXF. The <strong>Web-ContextPath</strong> is the context path for
this web application to be deployed at. And <strong>_wab</strong> is the
instruction  to point out the <strong>web.xml</strong> file location.
Please notice, the application will not be deployed under usual<strong>
/cxf</strong> endpoint (common endpoint for regular Apache CXF services). The
reason for that is that Pax Web is used for deployment of web CDI
applications.</p><h1
id="UsingCXFandCDI1.1/1.2(JSR-346)inOSGienvironment-WebApplicationConfiguration">Web
Application Configuration</h1><p>At the moment, Apache CXF OSGi application
should explicitly provide <strong>web.xml</strong> descriptor with at least
<strong>CXFCdiServlet </strong>defined. For example:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelConten
t pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servlet>
Modified:
websites/production/cxf/content/docs/using-cxf-and-failover-in-osgi-environment.html
==============================================================================
---
websites/production/cxf/content/docs/using-cxf-and-failover-in-osgi-environment.html
(original)
+++
websites/production/cxf/content/docs/using-cxf-and-failover-in-osgi-environment.html
Wed Sep 13 15:05:52 2017
@@ -131,7 +131,7 @@ install -s mvn:org.qi4j.core/org.qi4j.co
install -s mvn:org.qi4j.library/org.qi4j.library.jmx/2.1
install -s mvn:org.qi4j.library/org.qi4j.library.circuitbreaker/2.1</pre>
</div></div><h1
id="UsingCXFandFailoverinOSGienvironment-BlueprintConfiguration">Blueprint
Configuration</h1><p>Once all prerequisites are installed, the configuration
becomes really trivial, for example here is the OSGi blueprint snippet which
registers <a shape="rect" href="failoverfeature.html">JAX-WS</a> 
failover-aware client. Although it uses
<strong>circuit-breaker-failover</strong>, the way to register regular
<strong>failover</strong> and <strong>loadDistribution </strong>features
is very similar.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xmlns:clustering="http://cxf.apache.org/clustering"
Modified:
websites/production/cxf/content/docs/using-cxf-jca-rar-in-application-server.html
==============================================================================
---
websites/production/cxf/content/docs/using-cxf-jca-rar-in-application-server.html
(original)
+++
websites/production/cxf/content/docs/using-cxf-jca-rar-in-application-server.html
Wed Sep 13 15:05:52 2017
@@ -32,8 +32,8 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
@@ -121,11 +121,11 @@ Apache CXF -- Using CXF-JCA RAR in Appli
<p>cxf-integration-jca module has implemented the JCA1.5 outbound connection.
You can see samples in $CXF_HOME/samples/integration/jca.</p>
<style type="text/css">/*<![CDATA[*/
-div.rbtoc1505311192039 {padding: 0px;}
-div.rbtoc1505311192039 ul {list-style: disc;margin-left: 0px;padding-left:
20px;}
-div.rbtoc1505311192039 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1505314838226 {padding: 0px;}
+div.rbtoc1505314838226 ul {list-style: disc;margin-left: 0px;padding-left:
20px;}
+div.rbtoc1505314838226 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style><div class="toc-macro rbtoc1505311192039">
+/*]]>*/</style><div class="toc-macro rbtoc1505314838226">
<ul class="toc-indentation"><li><a shape="rect"
href="#UsingCXF-JCARARinApplicationServer-DeployCXF-JCARAR.">Deploy CXF-JCA
RAR.</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#UsingCXF-JCARARinApplicationServer-BuildCXF-JCARAR">Build CXF-JCA
RAR</a></li><li><a shape="rect"
href="#UsingCXF-JCARARinApplicationServer-DeployRARtoJBOSS.">Deploy RAR to
JBOSS.</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#UsingCXF-JCARARinApplicationServer-DeploythestandaloneRAR.">Deploy the
standalone RAR.</a></li><li><a shape="rect"
href="#UsingCXF-JCARARinApplicationServer-DeploytheRARinEAR.">Deploy the RAR in
EAR.</a></li></ul>
@@ -161,7 +161,7 @@ div.rbtoc1505311192039 li {margin-left:
<ul><li>geronimo-activation_1.1_spec-1.0-M1.jar</li><li>geronimo-annotation_1.0_spec-1.1.jar</li><li>geronimo-ws-metadata_2.0_spec-1.1.1.jar</li><li>jaxb-api-2.1.jar</li><li>jaxb-impl-2.1.4.jar</li><li>jaxb-xjc-2.1.4.jar</li><li>jsr181-api-1.0-MR1.jar</li><li>saaj-api-1.3.jar</li><li>saaj-impl-1.3.jar</li><li>stax-api-1.0.1.jar</li><li>stax-utils-20060502.jar</li></ul>
</li><li>Copy the rar to the $JBOSS_HOME/server/default</li><li>Create
the cxfj2ee_1_5-ds.xml as below, and copy it to $JBOSS_HOME/server/default
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<!DOCTYPE connection-factories
PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
"http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
@@ -182,7 +182,7 @@ div.rbtoc1505311192039 li {margin-left:
<p><strong>(Note: This has been tested against JBoss4.0.5 and
JBoss4.2.1)</strong></p>
<ul><li>Having application.xml
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<?xml version="1.0" encoding="UTF-8"?>
<application>
<display-name>cxf-jca</display-name>
@@ -196,7 +196,7 @@ div.rbtoc1505311192039 li {margin-left:
<ul><li>Having jboss-app.xml to configure the classloader.
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<?xml version="1.0" encoding="UTF-8"?>
<jboss-app>
<loader-repository>
@@ -215,7 +215,7 @@ div.rbtoc1505311192039 li {margin-left:
<ul><li>Having cxf-ds for jca outbound in JBoss.
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<?xml version="1.0" encoding="UTF-8"?>
<connection-factories>
<no-tx-connection-factory>
@@ -246,7 +246,7 @@ div.rbtoc1505311192039 li {margin-left:
<h3 id="UsingCXF-JCARARinApplicationServer-PackageRARinanEAR.">Package RAR in
an EAR.</h3>
<ul><li>Add a weblogic-ra.xml in the <strong>META-INF</strong> folder.
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<weblogic-connector xmlns="http://www.bea.com/ns/weblogic/90">
<outbound-resource-adapter>
<connection-definition-group>
@@ -274,7 +274,7 @@ div.rbtoc1505311192039 li {margin-left:
<h2
id="UsingCXF-JCARARinApplicationServer-GetConnectionfromManagedConnectionFactory.">Get
Connection from ManagedConnectionFactory.</h2>
<p>Below is the code snippet to get the Connection.</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
CXFConnectionRequestInfo cri = new
CXFConnectionRequestInfo(Greeter.class,
@@ -291,7 +291,7 @@ div.rbtoc1505311192039 li {margin-left:
<p>Also can get the connection without wsdl, but you need to provide the
address.</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
CXFConnectionRequestInfo requestInfo = new CXFConnectionRequestInfo();
requestInfo.setInterface(Greeter.class);
@@ -308,7 +308,7 @@ div.rbtoc1505311192039 li {margin-left:
If you want to deploy the Stateless Session Bean, you need to modify the
ejb_servant.properties file.</p>
<h3
id="UsingCXF-JCARARinApplicationServer-Activatetheejb_servant.propertiesfile.">Activate
the ejb_servant.properties file.</h3>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
# Format:
# jndi_name={namespace}ServiceName@url_to_swdl
#
Modified: websites/production/cxf/content/docs/using-cxf-with-maven.html
==============================================================================
--- websites/production/cxf/content/docs/using-cxf-with-maven.html (original)
+++ websites/production/cxf/content/docs/using-cxf-with-maven.html Wed Sep 13
15:05:52 2017
@@ -32,9 +32,9 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
-<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
<script src='/resources/highlighter/scripts/shBrushBash.js'></script>
+<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
@@ -119,7 +119,7 @@ Apache CXF -- Using CXF with maven
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><h1
id="UsingCXFwithmaven-MavenPOMInformation">Maven POM Information</h1><p>To use
CXF within Maven, you'll need to declare the CXF dependencies in your POM. The
CXF groupId is "org.apache.cxf". Here is a small example:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><properties>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><properties>
<cxf.version>2.2.3</cxf.version>
</properties>
@@ -143,7 +143,7 @@ Apache CXF -- Using CXF with maven
</dependencies>
</pre>
</div></div><p>For information on using Maven with CXF and Tomcat, this <a
shape="rect" class="external-link"
href="https://web-gmazza.rhcloud.com/blog/entry/web-service-tutorial"
rel="nofollow">blog entry</a> may be helpful.</p><h4
id="UsingCXFwithmaven-AdditionalDependencies">Additional
Dependencies</h4><p>Depending on your usage of CXF, you may need to bring in
additional dependencies--the mvn install process will usually make clear what
you are missing. Here's a non-exhaustive list of additional CXF artifacts that
may be needed:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><!-- Use dependency blocks for these CXF artifact
Ids just as above -->
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><!-- Use dependency blocks for these CXF artifact
Ids just as above -->
cxf-rt-core
cxf-rt-frontend-simple
cxf-rt-frontend-jaxws
@@ -156,7 +156,7 @@ cxf-rt-management
cxf-common-utilities
</pre>
</div></div><h4 id="UsingCXFwithmaven-MavenSnapshotRepository">Maven Snapshot
Repository</h4><p>To work with the latest non-release versions of CXF (not
recommended for production use), <a shape="rect" class="external-link"
href="http://www.nabble.com/CXF-snapshot-location-has-changed.-td22460813.html#a22460813"
rel="nofollow">updated nightly</a>, change the CXF version to the -SNAPSHOT
version desired and add the Apache snapshot repository to both the repositories
and pluginRepositories sections:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><repositories>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><repositories>
...other repos...
<repository>
<id>apache-snapshots</id>
Modified: websites/production/cxf/content/docs/using-opentracing.html
==============================================================================
--- websites/production/cxf/content/docs/using-opentracing.html (original)
+++ websites/production/cxf/content/docs/using-opentracing.html Wed Sep 13
15:05:52 2017
@@ -116,17 +116,17 @@ Apache CXF -- Using OpenTracing
<td height="100%">
<!-- Content -->
<div class="wiki-content">
-<div id="ConfluenceContent"><h1
id="UsingOpenTracing-/*<![CDATA[*/div.rbtoc1505311234989{padding:0px;}div.rbtoc1505311234989ul{list-style:disc;margin-left:0px;}div.rbtoc1505311234989li{margin-left:0px;padding-left:0px;}/*]]>*/#UsingOpenTracing-Overview#UsingOpenTracing-OverviewDistributedTr"><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1505311234989 {padding: 0px;}
-div.rbtoc1505311234989 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1505311234989 li {margin-left: 0px;padding-left: 0px;}
+<div id="ConfluenceContent"><h1
id="UsingOpenTracing-/*<![CDATA[*/div.rbtoc1505314901065{padding:0px;}div.rbtoc1505314901065ul{list-style:disc;margin-left:0px;}div.rbtoc1505314901065li{margin-left:0px;padding-left:0px;}/*]]>*/#UsingOpenTracing-Overview#UsingOpenTracing-OverviewDistributedTr"><style
type="text/css">/*<![CDATA[*/
+div.rbtoc1505314901065 {padding: 0px;}
+div.rbtoc1505314901065 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1505314901065 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></h1><div class="toc-macro rbtoc1505311234989">
+/*]]>*/</style></h1><div class="toc-macro rbtoc1505314901065">
<ul class="toc-indentation"><li><a shape="rect"
href="#UsingOpenTracing-"></a></li><li><a shape="rect"
href="#UsingOpenTracing-Overview">Overview</a></li><li><a shape="rect"
href="#UsingOpenTracing-DistributedTracinginApacheCXFusingOpenTracing">Distributed
Tracing in Apache CXF using OpenTracing</a></li><li><a shape="rect"
href="#UsingOpenTracing-ConfiguringClient">Configuring Client</a></li><li><a
shape="rect" href="#UsingOpenTracing-ConfiguringServer">Configuring
Server</a></li><li><a shape="rect"
href="#UsingOpenTracing-DistributedTracingInAction:UsageScenarios">Distributed
Tracing In Action: Usage Scenarios</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#UsingOpenTracing-Example#1:ClientandServerwithdefaultdistributedtracingconfigured">Example
#1: Client and Server with default distributed tracing
configured</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#2:ClientandServerwithnestedtrace">Example #2:
Client and Server with nested trace</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#3:ClientandServertracewithtimeline">Example #3:
Client and Server trace with timeline</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#4:ClientandServerwithbinaryannotations(key/value)">Example
#4: Client and Server with binary annotations (key/value)</a></li><li><a
shape="rect"
href="#UsingOpenTracing-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example
#5: Client and Server with parallel trace (involving thread
pools)</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side)">Exampl
e #6: Client and Server with asynchronous JAX-RS service
(server-side)</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example
#7: Client and Server with asynchronous invocation (client-side)</a></li></ul>
</li><li><a shape="rect"
href="#UsingOpenTracing-DistributedTracingwithOpenTracingandJAX-WSsupport">Distributed
Tracing with OpenTracing and JAX-WS support</a></li></ul>
</div><h1 id="UsingOpenTracing-Overview">Overview</h1><p><a shape="rect"
class="external-link" href="http://opentracing.io/"
rel="nofollow">OpenTracing</a> is a vendor-neutral open standard for
distributed tracing. Essentially, for Java-based projects the specification
exists as a set of <a shape="rect" class="external-link"
href="https://github.com/opentracing/opentracing-java" rel="nofollow">Java
APIs</a> which any distributed tracing solution is welcome to implement. There
are<a shape="rect" class="external-link"
href="http://opentracing.io/documentation/pages/supported-tracers"
rel="nofollow"> quite a few distributed tracing frameworks</a> available which
are compatible with <a shape="rect" class="external-link"
href="http://opentracing.io/" rel="nofollow">OpenTracing</a>, notably <a
shape="rect" class="external-link" href="http://zipkin.io/"
rel="nofollow">Zipkin</a> (via community contributions like <a shape="rect"
class="external-link" href="https://github.com/openzipkin/brav
e-opentracing" rel="nofollow">bridge from Brave to OpenTracing</a> ), <a
shape="rect" class="external-link" href="http://lightstep.com/"
rel="nofollow">Lightstep</a> and <a shape="rect" class="external-link"
href="https://uber.github.io/jaeger/" rel="nofollow">Jaeger</a>. Starting from
<strong>3.2.1</strong> release, Apache CXF fully supports integration (through
<strong>cxf-integration-tracing-opentracing</strong> module) with any
distributed tracer that provides <a shape="rect" class="external-link"
href="http://opentracing.io/" rel="nofollow">OpenTracing</a> <a
shape="rect" class="external-link"
href="https://github.com/opentracing/opentracing-java" rel="nofollow">Java
API</a> implementation.</p><p>The section <a shape="rect"
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Using+Apache+HTrace">dedicated
to Apache HTrace </a>has pretty good introduction into distributed tracing
basics however <a shape="rect" class="external-link"
href="http://opentracing.io/" rel="
nofollow">OpenTracing</a> specification abstracts a lot of things, outlining
just a general APIs to denote the <strong>Span </strong>lifecycle and
injection points to propagate the context across many distributed components.
As such, the intrinsic details about HTTP headers f.e. becomes an integral part
of the distributed tracer of your choice, out of reach for Apache CXF.</p><h1
id="UsingOpenTracing-DistributedTracinginApacheCXFusingOpenTracing">Distributed
Tracing in Apache CXF using OpenTracing</h1><p><a shape="rect"
href="http://cxf.apache.org/">Apache CXF</a> is a very popular framework for
building services and web APIs. No doubts, it is going to play even more
important role in context of microservices architecture letting developers to
quickly build and deploy individual JAX-RS/JAX-WS services. Distributed tracing
is an essential technique to observe the application platform as a whole,
breaking the request to individual service traces as it goes through and
crosses the
boundaries of threads, processes and machines.</p><p>The current integration
of distributed tracing in <a shape="rect" href="http://cxf.apache.org/">Apache
CXF</a> supports <a shape="rect" class="external-link"
href="http://opentracing.io/" rel="nofollow">OpenTracing</a> <a
shape="rect" class="external-link"
href="https://github.com/opentracing/opentracing-java" rel="nofollow">Java
API</a> <strong class="external-link">0.30.0+</strong> and provides
full-fledged support of JAX-RS 2.x / JAX-WS applications. From high-level
prospective, the JAX-RS integration consists of three main
parts:</p><ul><li><strong>TracerContext</strong> (injectable through
<strong>@Context</strong>
annotation)</li><li><strong>OpenTracingProvider</strong> (server-side JAX-RS
provider) and <strong>OpenTracingClientProvider</strong> (client-side JAX-RS
provider)</li><li class="external-link"><strong>OpenTracingFeature</strong>
(server-side JAX-RS feature) to simplify the configuration and integration<
/li></ul><p>Similarly, from high-level perspective, JAX-WS integration
includes:</p><ul><li><strong>OpenTracingStartInterceptor</strong> /
<strong>OpenTracingStopInterceptor</strong> /
<strong>OpenTracingFeature </strong><a shape="rect"
href="http://cxf.apache.org/">Apache CXF</a> feature (server-side JAX-WS
support)</li><li><strong>OpenTracingClientStartInterceptor</strong> /
<strong>OpenTracingClientStopInterceptor</strong> /
<strong>OpenTracingClientFeature </strong><a shape="rect"
href="http://cxf.apache.org/">Apache CXF</a> feature (client-side JAX-WS
support)</li></ul><p><a shape="rect" href="http://cxf.apache.org/">Apache
CXF</a> uses HTTP headers to hand off tracing context from the client to the
service and from the service to service. Those headers are specific to
distributing tracing framework you have picked and are not configurable at the
moment (unless the framework itself has a way to do that).</p><p>By default,
<strong>OpenTracingClientProvider</strong
> will try to pass the currently active <strong>span</strong> through HTTP
> headers on each service invocation. If there is no active spans, the new
> span will be created and passed through HTTP headers on per-invocation
> basis. Essentially, for JAX-RS applications just registering
> <strong>OpenTracingClientProvider</strong> on the client and
> <strong>OpenTracingProvider</strong> on the server is enough to have tracing
> context to be properly passed everywhere. The only configuration part which
> is necessary are <strong>span reports(s)</strong> and
> <strong>sampler</strong>(s) which are, not surprisingly, specific to
> distributing tracing framework you have chosen.</p><p>It is also worth to
> mention the way <a shape="rect" href="http://cxf.apache.org/">Apache CXF</a>
> attaches the description to <strong>spans</strong>. With regards to the
> client integration, the description becomes a full URL being invoked
> prefixed by HTTP method, for example: <strong>GET </strong><a shape="rect"
> class="extern
al-link" href="http://localhost:8282/books"
rel="nofollow"><strong>http://localhost:8282</strong>/books</a>. On the server
side integration, the description becomes a relative JAX-RS resource path
prefixed by HTTP method, f.e.: <strong>GET books, POST book/123</strong></p><h1
id="UsingOpenTracing-ConfiguringClient">Configuring Client</h1><p>In this
section and below, all the code snippets are going to be based on <a
shape="rect" class="external-link" href="https://uber.github.io/jaeger/"
rel="nofollow">Jaeger</a> distributed tracing framework (<strong>release
0.20.6+</strong>), although everything we are going to discuss is equally
applicable to any other existing alternatives. Essentially, the only dependency
<a shape="rect" href="http://cxf.apache.org/">Apache CXF</a> integration relies
on is the <strong>Tracer</strong> instance.</p><p>There are a couple of ways
the JAX-RS client could be configured, depending on the client implementation.
<a shape="rect" href="http://cxf.apache.o
rg/">Apache CXF</a> provides its own <strong>WebClient</strong> which could be
configured just like that (in future versions, there would be a simpler ways to
do that using client specific features):</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">final Tracer tracer = new Configuration("web-client",
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">final Tracer tracer = new Configuration("web-client",
new Configuration.SamplerConfiguration(ConstSampler.TYPE, 1), /* or
any other Sampler */
new Configuration.ReporterConfiguration(new
HttpSender("http://localhost:14268/api/traces")) /* or any other Sender */
).getTracer();
@@ -136,7 +136,7 @@ Response response = WebClient
.accept(MediaType.APPLICATION_JSON)
.get();</pre>
</div></div><p>The configuration based on using the standard JAX-RS
<strong>Client</strong> is very similar:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">final Tracer tracer = new Configuration("jaxrs-client",
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">final Tracer tracer = new Configuration("jaxrs-client",
new Configuration.SamplerConfiguration(ConstSampler.TYPE, 1), /* or
any other Sampler */
new Configuration.ReporterConfiguration(new
HttpSender("http://localhost:14268/api/traces")) /* or any other Sender */
).getTracer();
@@ -150,7 +150,7 @@ final Response response = client
.accept(MediaType.APPLICATION_JSON)
.get();</pre>
</div></div><p>Alternatively, you may use <strong>GlobalTracer</strong> to
pass the tracer around, for example:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">final Tracer tracer = new Configuration("jaxrs-client",
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">final Tracer tracer = new Configuration("jaxrs-client",
new Configuration.SamplerConfiguration(ConstSampler.TYPE, 1), /* or
any other Sampler */
new Configuration.ReporterConfiguration(new
HttpSender("http://localhost:14268/api/traces")) /* or any other Sender */
).getTracer();
@@ -161,7 +161,7 @@ GlobalTracer.register(tracer);
// No explicit Tracer instance is required, it will be picked off the
GlobalTracer using get() method
final OpenTracingClientProvider provider = new
OpenTracingClientProvider();</pre>
</div></div><h1 id="UsingOpenTracing-ConfiguringServer">Configuring
Server</h1><p>Server configuration is a bit simpler than the client one thanks
to the feature class available, <strong>OpenTracingFeature</strong>. Depending
on the way the <a shape="rect" href="http://cxf.apache.org/">Apache
CXF</a> is used to configure JAX-RS services, it could be part of JAX-RS
application configuration, for example:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@ApplicationPath( "/" )
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@ApplicationPath( "/" )
public class CatalogApplication extends Application {
@Override
public Set<Object> getSingletons() {
@@ -179,7 +179,7 @@ public class CatalogApplication extends
}
}</pre>
</div></div><p>Or it could be configured using
<strong>JAXRSServerFactoryBean</strong> as well, for example:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">final Tracer tracer = new
Configuration("tracer-server",
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">final Tracer tracer = new
Configuration("tracer-server",
new Configuration.SamplerConfiguration(ConstSampler.TYPE, 1), /* or
any other Sampler */
new Configuration.ReporterConfiguration(new
HttpSender("http://localhost:14268/api/traces")) /* or any other Sender */
).getTracer();
@@ -189,7 +189,7 @@ factory.setProvider(new OpenTracingFeatu
...
return factory.create();</pre>
</div></div><p>Alternatively, you may rely on <strong>GlobalTracer</strong> to
pass the tracer around, so in this case the <strong>OpenTracingFeature</strong>
will pick it up from there, for example:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@ApplicationPath( "/" )
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@ApplicationPath( "/" )
public class CatalogApplication extends Application {
@Override
public Set<Object> getSingletons() {
@@ -202,7 +202,7 @@ public class CatalogApplication extends
}
}</pre>
</div></div><p>Once the <strong>span reporter</strong> and
<strong>sampler</strong> are properly configured, all generated
<strong>spans</strong> are going to be collected and available for analysis
and/or visualization.</p><h1
id="UsingOpenTracing-DistributedTracingInAction:UsageScenarios">Distributed
Tracing In Action: Usage Scenarios</h1><p class="confluence-link">In the
following subsections we are going to walk through many different scenarios to
illustrate the distributed tracing in action, starting from the simplest ones
and finishing with asynchronous JAX-RS services. All examples assume that
configuration <strong>has been done</strong> (see please <a shape="rect"
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Using+OpenTracing#UsingOpenTracing-ConfiguringClient"><span
class="confluence-link"><span class="confluence-link">Configuring
Client</span></span></a><span class="confluence-link"> </span> and<a
shape="rect" href="https://cwiki.apache.org/confluence/di
splay/CXF20DOC/Using+OpenTracing#UsingOpenTracing-configuringserver"><span
class="confluence-link"> </span></a><a shape="rect"
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Using+OpenTracing#UsingOpenTracing-ConfiguringServer"><span
class="confluence-link">Configuring Server</span></a> sections above).</p><h2
id="UsingOpenTracing-Example#1:ClientandServerwithdefaultdistributedtracingconfigured">Example
#1: Client and Server with default distributed tracing configured</h2><p>In
the first example we are going to see the effect of using default configuration
on the client and on the server, with only
<strong>OpenTracingClientProvider</strong>  and
<strong><strong>OpenTracing</strong>Provider</strong> registered. The JAX-RS
resource endpoint is pretty basic stubbed method:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks() {
return Arrays.asList(
@@ -210,13 +210,13 @@ public Collection<Book> getBooks()
);
}</pre>
</div></div><p>The client is as simple as that:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">final Response response = client
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">final Response response = client
.target("http://localhost:8282/books")
.request()
.accept(MediaType.APPLICATION_JSON)
.get();</pre>
</div></div><p>The actual invocation of the request by the client (with
service name <strong>tracer-client</strong>) and consequent invocation of the
service on the server side (service name<strong> tracer-server</strong>) is
going to generate the following sample traces (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2012:41:7.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2013:18
:20.png"></span></p><h2
id="UsingOpenTracing-Example#2:ClientandServerwithnestedtrace">Example #2:
Client and Server with nested trace</h2><p>In this example server-side
implementation of the JAX-RS service is going to call an external system
(simulated as a simple delay of 500ms) within its own span. The client-side
code stays unchanged.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
try(final ActiveSpan scope = tracer.startSpan("Calling External System")) {
@@ -229,7 +229,7 @@ public Collection<Book> getBooks(@
}
}</pre>
</div></div><p>The actual invocation of the request by the client (with
service name <strong><span class="label label-default service-filter-label
service-tag-filtered"><strong>tracer</strong>-client</span></strong>) and
consequent invocation of the service on the server side (service
name<strong><span class="label label-default service-filter-label"><strong>
tracer-</strong>server</span></strong><span class="label label-default
service-filter-label">)</span> is going to generate the following sample traces
(taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2014:9:7.png"></span></p><p>The same
trace will be looking pretty similar using traditional <a shape="rect"
class="external-link" href="https://github.com/openzipkin/zipkin/tree/mast
er/zipkin-ui" rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:10:40.png"></span></p><h2
id="UsingOpenTracing-Example#3:ClientandServertracewithtimeline">Example #3:
Client and Server trace with timeline</h2><p>In this example server-side
implementation of the JAX-RS service is going to add timeline to the active
span. The client-side code stays unchanged.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
tracer.timeline("Preparing Books");
@@ -241,7 +241,7 @@ public Collection<Book> getBooks(@
);
}</pre>
</div></div><p>The actual invocation of the request by the client (with
service name <strong><span class="label label-default service-filter-label
service-tag-filtered">tracer-client</span></strong>) and consequent invocation
of the service on the server side (service name<strong> <span class="label
label-default service-filter-label">traceser-server</span></strong>) is going
to generate the following sample traces (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="400"
src="using-opentracing.data/image2017-9-10%2014:26:23.png"></span></p><p> </p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>Please
notice that timelines are treated as<strong> logs events</strong> in <a
shape="rect" class="external-link" href="https://uber.github.io/jaeger/"
rel="nofollow">Jaeger</a>.</p></div></div><p>The same trace will be looking
pretty similar using traditional <a shape="rect" class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:19:1.png"></span></p><h2
id="UsingOpenTracing-Example#4:ClientandServerwithbinaryannotations(key/value)">Example
#4: Client and Server with binary annotations (key/value)</h2><p>In this
example server-side implementation of the JAX-RS service is going to add
key/value annotations to the active span. The client-side code stays
unchanged.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeC
ontent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
final Collection<Book> books = Arrays.asList(
@@ -252,7 +252,7 @@ public Collection<Book> getBooks(@
return books;
}</pre>
</div></div><p>The actual invocation of the request by the client (with
service name <strong><span class="label label-default service-filter-label
service-tag-filtered"><strong><span class="label label-default
service-filter-label
service-tag-filtered"><strong>tracer</strong></span></strong>-client</span></strong>)
and consequent invocation of the service on the server side (service
name<strong> tracer-<span class="label label-default
service-filter-label">server</span></strong>) is going to generate the
following sample server trace properties (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="400"
src="using-opentracing.data/image2017-9-10%2014:40:20.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link" href="https:
//github.com/openzipkin/zipkin/tree/master/zipkin-ui" rel="nofollow">Zipkin
UI</a> frontend:</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2014:46:4.png"></span></p><h2
id="UsingOpenTracing-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example
#5: Client and Server with parallel trace (involving thread pools)</h2><p>In
this example server-side implementation of the JAX-RS service is going to
offload some work into thread pool and then return the response to the client,
simulating parallel execution. The client-side code stays unchanged.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
final Future<Book> book1 = executor.submit(
@@ -282,7 +282,7 @@ public Collection<Book> getBooks(@
return Arrays.asList(book1.get(), book2.get());
}</pre>
</div></div><p>The actual invocation of the request by the client (with
service name <strong>tracer-<span class="label label-default
service-filter-label service-tag-filtered">client</span></strong>) and
consequent invocation of the service on the server side (process name<strong>
tracer-<span class="label label-default
service-filter-label">server</span></strong>) is going to generate the
following sample traces (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2014:49:4.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-fil
e-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:50:2.png"></span></p><h2
id="UsingOpenTracing-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side)">Example
#6: Client and Server with asynchronous JAX-RS service (server-side)</h2><p>In
this example server-side implementation of the JAX-RS service is going to be
executed asynchronously. It poses a challenge from the tracing prospective as
request and response are processed in different threads (in general). At the
moment, <a shape="rect" href="http://cxf.apache.org/">Apache CXF</a> does not
support the transparent tracing spans management (except for default use case)
but provides the simple ways to do that (by letting to transfer spans from
thread to thread). The client-side code stays unchanged.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
@GET
public void getBooks(@Suspended final AsyncResponse response, @Context final
TracerContext tracer) throws Exception {
tracer.continueSpan(new Traceable<Future<Void>>() {
@@ -307,7 +307,7 @@ public void getBooks(@Suspended final As
});
}</pre>
</div></div><p>The actual invocation of the request by the client (with
service name <strong>tracer-<span class="label label-default
service-filter-label service-tag-filtered">client</span></strong>) and
consequent invocation of the service on the server side (service name<strong>
tracer-<span class="label label-default
service-filter-label">server</span></strong>) is going to generate the
following sample traces (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2014:54:2.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-fil
e-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:55:0.png"></span></p><h2
id="UsingOpenTracing-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example
#7: Client and Server with asynchronous invocation (client-side)</h2><p>In
this example server-side implementation of the JAX-RS service is going to be
the default one:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks() {
return Arrays.asList(
@@ -315,14 +315,14 @@ public Collection<Book> getBooks()
);
}</pre>
</div></div><p>While the JAX-RS client implementation is going to perform
the asynchronous invocation:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">final Future<Response> future = client
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">final Future<Response> future = client
.target("http://localhost:8282/books")
.request()
.accept(MediaType.APPLICATION_JSON)
.async()
.get();</pre>
</div></div><p>In this respect, there is no difference from the caller
prospective however a bit more work is going under the hood to transfer the
active tracing span from JAX-RS client request filter to client response filter
as in general those are executed in different threads (similarly to server-side
asynchronous JAX-RS resource invocation). The actual invocation of the request
by the client (with service name <strong>tracer-<span class="label
label-default service-filter-label
service-tag-filtered">client</span></strong>) and consequent invocation of the
service on the server side (service name<strong> tracer-<span class="label
label-default service-filter-label">server</span></strong>) is going to
generate the following sample traces (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2015:0:49.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:58:53.png"></span></p><h1
id="UsingOpenTracing-DistributedTracingwithOpenTracingandJAX-WSsupport">Distributed
Tracing with OpenTracing and JAX-WS support</h1><p>Distributed tracing in the
<a shape="rect" href="http://cxf.apache.org/">Apache CXF</a> is build primarily
around JAX-RS 2.x implementation. However, JAX-WS is also supported but it
requires to write some boiler-plate code and use <a shape="rect"
class="external-link" href="http://opentracing.io/"
rel="nofollow">OpenTracing</a> <a shape="rect" cla
ss="external-link" href="https://github.com/opentracing/opentracing-java"
rel="nofollow">Java API</a> directly (the JAX-WS integration is going to be
enhanced in the future). Essentially, from the server-side prospective the
in/out interceptors, <strong>OpenTracingStartInterceptor</strong> and
<strong><strong>OpenTracing</strong>StopInterceptor </strong>respectively,
should be configured as part of interceptor chains, either manually or using
<strong><strong>OpenTracing</strong>Feature</strong>. For example:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">final Tracer tracer = new Configuration("tracer",
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">final Tracer tracer = new Configuration("tracer",
new Configuration.SamplerConfiguration(ConstSampler.TYPE, 1), /* or
any other Sampler */
new Configuration.ReporterConfiguration(new
HttpSender("http://localhost:14268/api/traces")) /* or any other Sender */
).getTracer();
@@ -333,7 +333,7 @@ sf.getFeatures().add(new OpenTracingFeat
...
sf.create();</pre>
</div></div><p>Similarly to the server-side, client-side needs own set of
out/in interceptors,
<strong><strong>OpenTracing</strong>ClientStartInterceptor</strong> and
<strong><strong>OpenTracing</strong>ClientStopInterceptor</strong> (or
<strong><strong>OpenTracing</strong>ClientFeature</strong>). Please notice the
difference from server-side: 
<strong><strong>OpenTracing</strong>ClientStartInterceptor</strong> becomes
out-interceptor while
<strong><strong>OpenTracing</strong>ClientStopInterceptor</strong> becomes
in-interceptor. For example:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">final Tracer tracer = new Configuration("tracer",
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">final Tracer tracer = new Configuration("tracer",
new Configuration.SamplerConfiguration(ConstSampler.TYPE, 1), /* or
any other Sampler */
new Configuration.ReporterConfiguration(new
HttpSender("http://localhost:14268/api/traces")) /* or any other Sender */
).getTracer();