Announcement Announcement Module
Collapse
No announcement yet.
Delivery mode will be ignored using execute(Destination, ProducerCallback) method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Delivery mode will be ignored using execute(Destination, ProducerCallback) method

    Hi,

    I wrote a JMS call using the JMSTemplate with a ProducerCallback. The deliverymode is ignored totally.

    Code:
    this.jmsTemplate.execute(this.jmsTemplate.getDefaultDestination(), new PingProducerCallback(n.getName(), "Send me something back " + n.getName()));
    My doInJms method in the PingProducerCallback is:

    Code:
     
    			final TemporaryQueue tempQueue = pSession.createTemporaryQueue();
    			try {
    				final TextMessage message = pSession.createTextMessage();
    				message.setText(this.messageToSend);
    				message.setStringProperty("NODE", this.nodeName);
    				message.setJMSReplyTo(tempQueue);
    				pMessageproducer.send(message);
    				return AlivePingTask.this.jmsTemplate.receiveAndConvert(tempQueue);
    			} finally {
    				tempQueue.delete();
    			}
    I configured delivery mode and time to live:

    Code:
    	<bean id="pingJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    		<property name="connectionFactory" ref="connectionFactory" />
    		<property name="defaultDestination" ref="pingQueue" />
    		<property name="timeToLive" value="10000"/>
    		<property name="receiveTimeout" value="10000"/>
    		<property name="deliveryPersistent" value="false"/>
    		<property name="explicitQosEnabled" value="true" />
    	</bean>
    Unfortunately, the deliveryPersistent will be ignored. The ProducerCallback is using default delivery mode.

    So my question is: Is this a bug or do I have to write the doInJMS method in another way?
    Deliverymode will only be used in case of usage of the method convertAndSend(...), because there is called:

    Code:
    	protected void doSend(MessageProducer producer, Message message) throws JMSException {
    		if (isExplicitQosEnabled()) {
    			producer.send(message, getDeliveryMode(), getPriority(), getTimeToLive());
    		}
    		else {
    			producer.send(message);
    		}
    	}
    The only solution is to set the delivery mode in every Callback on my own. But this is not what I want, because I want to define this only once per JMSTemplate.

    Thanks a lot

    Joachim
Working...
X