It appears that setting org.apache.cxf.jms.client.timeout in the
requestContext has no affect, so someone may want to update the
jms_queue sample.
I was able to use JMSConfiguration object as follows:
InvocationHandler handler = Proxy.getInvocationHandler(greeter);
JMSConduit conduit =
(JMSConduit)ClientProxy.getClient(greeter).getConduit();
conduit.getJmsConfig().setReceiveTimeout(15000);
This requires the following additional imports:
import org.apache.cxf.transport.jms.JMSConduit;
import org.apache.cxf.frontend.ClientProxy;
-Mike
> -----Original Message-----
> From: Michael Ramnarine [mailto:[email protected]]
> Sent: Sunday, May 10, 2009 11:15 PM
> To: [email protected]
> Subject: How to set clientReceiveTimeout programatically (without
> wsdl or spring config)?
>
> I'm trying to set the client receive timeout (and other jms config)
> via code rather than spring config or wsdl config like:
> <jms:clientConfig clientReceiveTimeout="1000" />
>
> At first glance the following sample is set up to do just what I'm
> trying to do:
> apache-cxf-
> 2.2.1/samples/jms_queue/src/demo/jms_greeter/client/Client.java
>
> However when this sample is run with no server running the client
> takes the default time to timeout (which is 60 seconds in 2.2.1),
> rather than the 1 second that is configured in the code. Adding the
> config mentioned above to the port in wsdl works. I've tried a few
> variations for the key in java, like the following, but this hasn't
> worked:
>
> requestContext.put("org.apache.cxf.transports.jms.ClientConfig.client
> ReceiveTimeout", new Long(1000));
>
> Can anyone suggest ways to set this config programmatically rather
> than in wsdl or spring?
>
> -Mike