Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5257

cxf-rt-transports-jms jms expiration is not set in JMSUtils.setJMSMessageHeaderProperties()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.9, 2.7.6
    • 2.6.10, 2.7.7
    • Transports
    • CXf client frontends cxf-rt-frontend-jaxws, cxf-rt-transports-jms version 2.7.5

    • Novice

    Description

      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());
      }

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            medecigo3 Arturo Medecigo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 4h
                4h
                Remaining:
                Remaining Estimate - 4h
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified