cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Pezzei <ben.pez...@gmail.com>
Subject Retry-Mechanism
Date Tue, 03 Jan 2012 13:30:14 GMT
Hi

I am trying to use the Retry-Feature (added in 2.4.4).

Client is configured like this:

<bean id="retryStrategy" class="org.apache.cxf.clustering.RetryStrategy">
	<property name="maxNumberOfRetries" value="5"/>	
	<property name="delayBetweenRetries" value="7000"/>
</bean>

<jaxws:client id="someService"
                serviceClass="someClass">
	<jaxws:features>
        <clustering:failover>
            <clustering:strategy>
                <ref bean="retryStrategy"/>
            </clustering:strategy>
        </clustering:failover>
    </jaxws:features>
</jaxws:client>

The idea may be an automatic retry if an IOException occurs (timeout,
Connection refused
or similar).

Note, that we don't use any alternate Addresses in the Strategy (we set the
address before invocation):

BindingProvider bp = (BindingProvider) port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
props.getEndpointAddress());

With this Setup (and if we set the address to some inaccessible url)
the retryStrategy is only invoked once
and stops after one iteration:

WARN - AbstractStaticFailoverStrategy.selectAlternateEndpoint(115) |
no alternate targets remain => giving up on failover

Since we need also some Businesslogic within the Retry-Feature (which
per se is not threadsafe), i'd like
to know, if there are other ways of doing this (Perhaps a
retryInterceptor)? If so, a short example may be highly
appreciated

regards
Ben

Mime
View raw message