@Override public void initialize(Server server, Bus bus) { Destination destination = server.getDestination(); if (destination instanceof JMSDestination) { JMSDestination jmsDestination = (JMSDestination)destination; jmsDestination.getJmsConfig().setConnectionFactory(connectionFactory); } super.initialize(server, bus); } private class JMSConduitConfigOutInterceptor extends AbstractPhaseInterceptor<Message> {
ConfiguredBeanLocator locator = bus.getExtension(ConfiguredBeanLocator.class); if (endpoint.getConnectionFactory() != null) { jmsConfig.setConnectionFactory(endpoint.getConnectionFactory()); } else if (locator != null) { ConnectionFactory.class); if (cf != null) { jmsConfig.setConnectionFactory(cf);
@Override public void handleMessage(Message message) throws Fault { Conduit conduit = message.getExchange().getConduit(message); if (conduit instanceof JMSConduit) { JMSConduit jmsConduit = (JMSConduit)conduit; jmsConduit.getJmsConfig().setConnectionFactory(connectionFactory); } } }
@Test(expected = SOAPFaultException.class) public void testReplyAndReplyToDestinations() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setWsdlLocation("classpath:/wsdl/jms_test.wsdl"); factory.setServiceName(new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService")); factory.setEndpointName(new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort")); factory.setAddress("jms://"); JMSConfigFeature feature = new JMSConfigFeature(); JMSConfiguration config = new JMSConfiguration(); config.setConnectionFactory(new ActiveMQConnectionFactory(broker.getBrokerURL())); config.setRequestURI("test.jmstransport.text"); config.setTargetDestination("test.jmstransport.text"); // replyDestination and replyToDestination intentionally differ in this test scenario // replyDestination = Destination name to listen on for reply messages config.setReplyDestination("test.jmstransport.text.reply"); // replyToDestination = Destination name to send out as replyTo address in the message config.setReplyToDestination("test.jmstransport.text.replyTo"); config.setReceiveTimeout(1000L); feature.setJmsConfig(config); factory.getFeatures().add(feature); HelloWorldPortType greeter = factory.create(HelloWorldPortType.class); try { greeter.greetMe("FooBar"); // Timeout exception should be thrown } finally { ((java.io.Closeable)greeter).close(); } }