Hi all,
we were discussing a new way of configuring JMS transport and perhaps
even other transports. One problem for a short term solution is that
this requires some changes in central modules. This is something I am
reluctant to do myself as it affects all modules.
To get ahead faster I have found a non intrusive way of integrating the
configuation into the client or endpoint. I simply used a Feature. This
way we can experiment with the new config style without doing
greater changes up front. This could even be integrated into the next
release as it should not have any risk. The only thing is that we will
have to tell people that this config style is only temporary and will be
changed later.
The feature is called after the normal conduit creation. So the configs
in the Feature will override the normal config.
What do you think?
Greetings
Christian
This is the code for the Feature
------------
public class JMSConfigFeature extends AbstractFeature {
JMSConfiguration jmsConfig;
@Override
public void initialize(Client client, Bus bus) {
Conduit conduit = client.getConduit();
if (conduit instanceof JMSConduit && jmsConfig != null) {
JMSConduit jmsConduit = (JMSConduit)conduit;
jmsConduit.setJmsConfig(jmsConfig);
}
super.initialize(client, bus);
}
public JMSConfiguration getJmsConfig() {
return jmsConfig;
}
@Required
public void setJmsConfig(JMSConfiguration jmsConfig) {
this.jmsConfig = jmsConfig;
}
}
---------
That´s how the config is done. The config here is all that is needed to
setup a JMS Transport for a client.
----------
<bean id="jmsConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
<property name="targetConnectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
</property>
</bean>
<bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration"
p:connectionFactory-ref="jmsConnectionFactory"
p:targetDestination="test.cxf.jmstransport.queue"
/>
<client id="CustomerService" xmlns="http://cxf.apache.org/jaxws"
xmlns:customer="http://customerservice.example.com/"
serviceName="customer:CustomerServiceService"
endpointName="customer:CustomerServiceEndpoint"
address="jms://"
serviceClass="com.example.customerservice.CustomerService">
<features>
<bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.cxf.transport.jms.JMSConfigFeature">
<property name="jmsConfig" ref="jmsConfig"></property>
</bean>
</features>
</client>
--
Christian Schneider
---
http://www.liquid-reality.de