You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Christian Schneider <ch...@die-schneider.net> on 2008/10/05 00:42:34 UTC
Idea how to realize the new JMS configuration without any change
to other modules
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
Re: Idea how to realize the new JMS configuration without any change
to other modules
Posted by Christian Schneider <ch...@die-schneider.net>.
It would look the same .. but it would not work ... Forgot to implement
the server part ;-)
Added it in a new commit.
I will write a Wiki page for the new configuration style.
Greetings
Christian
Willem Jiang schrieb:
> Hi Christian,
>
> You could also add a configuration example for the JMS destination :)
>
> Willem
>
> Christian Schneider wrote:
>> 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
Re: Idea how to realize the new JMS configuration without any change
to other modules
Posted by Willem Jiang <wi...@gmail.com>.
Hi Christian,
You could also add a configuration example for the JMS destination :)
Willem
Christian Schneider wrote:
> 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>
>