Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Implementing CXF client and service using JMS transport is trivial. Basically, it is enough to configure two things in WSDL: a)

  1. specify jms transport URI in binding element;

...

  1. define jms address in port element.
    WSDL binding and port should look like:
Code Block
borderStylesolid
<wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
        <soap:binding style="document" transport="http://cxf.apache.org/transports/jms"/>
…
</wsdl:binding>

<wsdl:service name="JMSGreeterService">
        <wsdl:port binding="tns:JMSGreeterPortBinding" name="GreeterPort">
            <jms:address
                destinationStyle="queue"
                jndiConnectionFactoryName="ConnectionFactory" 
jndiDestinationName="dynamicQueues/test.cxf.jmstransport.queue">
               <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
                  <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61616"/>
           </jms:address>
        </wsdl:port>
 </wsdl:service>

...

Unfortunately there are two main scalability drawbacks in default JMS configuration: 1.

  1. It doesn't provide sessions pooling and consumers/producers cache.

...

  1. Default JMS message consumer is single threaded. It means that only one thread will get messages from the queue or topic and pass them to further processing.

Both aspects are critical for enterprise application and their implementation is not easy task. Is there any solution? Yes: Spring JMS functionality and CXF Features. Let discuss them in detail.

...

Client configuration looks very similar to the server one except two things: a)

  1. CachingConnectionFactory activates producers caching instead consumers caching;

...

  1. JMSConfiguration hasn’t concurrent consumers settings: client concurrency is under application control and can be implemented using standard Java concurrency API.

Conclusion: it is possible to achieve scalability of CXF client and service using Spring JMS functionality and CXF JMS Configuration Feature. It is not necessary to write any line of code, just configure and leverage already existing stuff.

...