Expose setExceptionListener on AbstractJmsListenerContainerFactory

Closes gh-22102
This commit is contained in:
Juergen Hoeller
2020-07-19 19:53:01 +02:00
parent bd3b44838f
commit 165a6f186d

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.jms.config;
import javax.jms.ConnectionFactory;
import javax.jms.ExceptionListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -48,10 +49,13 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
private DestinationResolver destinationResolver;
@Nullable
private ErrorHandler errorHandler;
private MessageConverter messageConverter;
@Nullable
private MessageConverter messageConverter;
private ExceptionListener exceptionListener;
@Nullable
private ErrorHandler errorHandler;
@Nullable
private Boolean sessionTransacted;
@@ -98,13 +102,6 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
this.destinationResolver = destinationResolver;
}
/**
* @see AbstractMessageListenerContainer#setErrorHandler(ErrorHandler)
*/
public void setErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
/**
* @see AbstractMessageListenerContainer#setMessageConverter(MessageConverter)
*/
@@ -112,6 +109,21 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
this.messageConverter = messageConverter;
}
/**
* @since 5.2.8
* @see AbstractMessageListenerContainer#setExceptionListener(ExceptionListener)
*/
public void setExceptionListener(ExceptionListener exceptionListener) {
this.exceptionListener = exceptionListener;
}
/**
* @see AbstractMessageListenerContainer#setErrorHandler(ErrorHandler)
*/
public void setErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
/**
* @see AbstractMessageListenerContainer#setSessionTransacted(boolean)
*/
@@ -182,6 +194,7 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
this.autoStartup = autoStartup;
}
@Override
public C createListenerContainer(JmsListenerEndpoint endpoint) {
C instance = createContainerInstance();
@@ -192,12 +205,15 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
if (this.destinationResolver != null) {
instance.setDestinationResolver(this.destinationResolver);
}
if (this.errorHandler != null) {
instance.setErrorHandler(this.errorHandler);
}
if (this.messageConverter != null) {
instance.setMessageConverter(this.messageConverter);
}
if (this.exceptionListener != null) {
instance.setExceptionListener(this.exceptionListener);
}
if (this.errorHandler != null) {
instance.setErrorHandler(this.errorHandler);
}
if (this.sessionTransacted != null) {
instance.setSessionTransacted(this.sessionTransacted);
}