How’s the proceeding, to let the DefaultMessageListenerContainer control transactions…as far as I read, I only have to provide the sessionTransacted-property to the DMLC. My goal is to put the message back to the queue, if some errors occure…
Has been searching for quite a while and but didn’t found anything…
My Spring-config (a part of it):
<bean id="abstractMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer" abstract="true">
<property name="connectionFactory" ref="connectionFactory" />
<property name="maxConcurrentConsumers" value="5"/>
<property name="receiveTimeout" value="10000" />
</bean>
<bean class="org.springframework.jms.listener.DefaultMessageListenerContainer" parent="abstractMessageListenerContainer">
<property name="destinationName" value="MY.QUEUE" />
<property name="messageListener" ref="myMessageListener" />
<property name="sessionTransacted" value="true" />
</bean>
<bean id="myMessageListener" class="my.package.structure.ListenerClass"></bean>
My Listener Class:
public class ListenerClass implements MessageListener {
public void onMessage(Message msg) {
}
}
is it simply by throwing an unchecked exception (like java.lang.IllegalStateException)?
message will rollback in case a unchecked exception will be thrown! checked exceptions can’t be thrown, because they’re not mentioned in the method-signature of the onMessage-method of MessageListener interface.