use of org.apache.cxf.endpoint.ConduitSelector in project cxf by apache.
the class FailoverFeature method initialize.
@Override
public void initialize(Client client, Bus bus) {
ConduitSelector selector = initTargetSelector(client.getConduitSelector().getEndpoint());
client.setConduitSelector(selector);
}
use of org.apache.cxf.endpoint.ConduitSelector in project cxf by apache.
the class ColocFeature method initialize.
@Override
public void initialize(Client client, Bus bus) {
ConduitSelector selector = new DeferredConduitSelector();
selector.setEndpoint(client.getEndpoint());
client.setConduitSelector(selector);
initializeProvider(client, bus);
}
use of org.apache.cxf.endpoint.ConduitSelector in project fabric8 by jboss-fuse.
the class FabricLoadBalancerFeature method initialize.
// this method will be used for JAXRS client
public void initialize(InterceptorProvider interceptorProvider, Bus bus) {
// try to find if the InterceptorProvider is a ConduitSelectorHolder
if (interceptorProvider instanceof ConduitSelectorHolder) {
ConduitSelectorHolder holder = (ConduitSelectorHolder) interceptorProvider;
// get the endpoint of the original ConduitSelector
ConduitSelector oldSelector = holder.getConduitSelector();
LoadBalanceTargetSelector selector = getDefaultLoadBalanceTargetSelector();
selector.setEndpoint(oldSelector.getEndpoint());
try {
selector.setLoadBalanceStrategy(getLoadBalanceStrategy());
holder.setConduitSelector(selector);
} catch (Exception e) {
LOG.error("Cannot setup the LoadBalanceStrategy due to " + e);
}
// setup the BusLifeCycleListener
BusLifeCycleManager manager = bus.getExtension(BusLifeCycleManager.class);
manager.registerLifeCycleListener(this);
try {
Thread.sleep(getWaitingForGroupEvent());
} catch (InterruptedException e) {
LOG.warn("InterruptedException when wait for the GroupEvent notification " + e);
}
}
}
use of org.apache.cxf.endpoint.ConduitSelector in project cxf by apache.
the class JAXRSClientFactoryBean method getConduitSelector.
protected ConduitSelector getConduitSelector(Endpoint ep) {
ConduitSelector cs = getConduitSelector();
if (cs == null) {
cs = new UpfrontConduitSelector();
}
cs.setEndpoint(ep);
return cs;
}
use of org.apache.cxf.endpoint.ConduitSelector in project cxf by apache.
the class Proxy method createClient.
protected Client createClient(Bus bus, Endpoint endpoint, final ProtocolVariation protocol, Conduit conduit, final EndpointReferenceType address) {
ConduitSelector cs = new DeferredConduitSelector(conduit) {
@Override
public synchronized Conduit selectConduit(Message message) {
final Conduit conduit;
EndpointInfo endpointInfo = getEndpoint().getEndpointInfo();
EndpointReferenceType original = endpointInfo.getTarget();
try {
if (null != address) {
endpointInfo.setAddress(address);
}
conduit = super.selectConduit(message);
} finally {
endpointInfo.setAddress(original);
}
return conduit;
}
};
RMClient client = new RMClient(bus, endpoint, cs);
// WS-RM requires ws-addressing
WSAddressingFeature wsa = new WSAddressingFeature();
wsa.setAddressingRequired(true);
wsa.initialize(client, bus);
Map<String, Object> context = client.getRequestContext();
context.put(MAPAggregator.ADDRESSING_NAMESPACE, protocol.getWSANamespace());
context.put(RMManager.WSRM_VERSION_PROPERTY, protocol.getWSRMNamespace());
context.put(RMManager.WSRM_WSA_VERSION_PROPERTY, protocol.getWSANamespace());
return client;
}
Aggregations