Arturo Medecigo created CXF-5257:
------------------------------------
Summary: cxf-rt-transports-jms jms expiration is not set in
JMSUtils.setJMSMessageHeaderProperties()
Key: CXF-5257
URL: https://issues.apache.org/jira/browse/CXF-5257
Project: CXF
Issue Type: Bug
Components: Transports
Affects Versions: 2.7.6, 2.3.9
Environment: CXf client frontends cxf-rt-frontend-jaxws,
cxf-rt-transports-jms version 2.7.5
Reporter: Arturo Medecigo
When configuring a JaxWsProxyFactoryBean client with a JMSConduit either
programmatically, or via spring configuration, the JMSTimeToLive header
property is not set.
Java code:
JMSConfiguration jmsConfig = new JMSConfiguration();
JNDIConfiguration jndiConfig = new JNDIConfiguration();
JndiTemplate jndiTemplate = new JndiTemplate();
Properties env = new Properties();
JMSConfigFeature jmsFeature = new JMSConfigFeature();
List <Feature> featureList= new ArrayList <Feature>();
env.put(Context.PROVIDER_URL, JMS_BROKER_URL);
env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
jndiTemplate.setEnvironment(env);
jndiConfig.setJndiConnectionFactoryName(CONNECTION_FACTORY_NAME);
jndiConfig.setEnvironment(env);
jmsConfig.setJndiTemplate(jndiTemplate);
jmsConfig.setJndiConfig(jndiConfig);
jmsConfig.setTimeToLive(TIME_TO_LIVE);
jmsConfig.setTargetDestination(JMS_DESTINATION);
jmsConfig.setReplyDestination(JMS_REPLY_DESTINATION);
jmsFeature.setJmsConfig(jmsConfig);
featureList.add(jmsFeature);
proxyFactoryProto.setFeatures(featureList);
proxyFactoryProto.create();
or via spring:
<bean id="proxyFactoryProto" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="com.myservice.HelloWorld"/>
<property name="transportId"
value="#{T(org.apache.cxf.transport.jms.spec.JMSSpecConstants).SOAP_JMS_SPECIFICATION_TRANSPORTID}"></property>
<property name="features">
<list>
<ref bean="jmsConfigFeature"/>
</list>
</property>
</bean>
<bean id="jmsConfigFeature"
class="org.apache.cxf.transport.jms.JMSConfigFeature">
<property name="jmsConfig" ref="jmsConfig"/>
</bean>
<bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="timeToLive" value="5000"/>
<property name="targetDestination" value="service.hello"/>
<property name="replyDestination" value="service.hello.reply"/>
</bean>
To fix it simply uncomment the following code at
org.apache.cxf.transport.jms.JMSUtils.setJMSMessageHeaderProperties()
//if (messageProperties.isSetTimeToLive()) {
// jmsMessage.setJMSExpiration(expiration);
// }
and fix with:
if (messageProperties.isSetTimeToLive()) {
jmsMessage.setJMSExpiration(messageProperties.getJMSExpiration());
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira