Skip to content

Commit

Permalink
Expose setExceptionListener on AbstractJmsListenerContainerFactory
Browse files Browse the repository at this point in the history
Closes gh-22102
  • Loading branch information
jhoeller committed Jul 19, 2020
1 parent bd3b448 commit 165a6f1
Showing 1 changed file with 28 additions and 12 deletions.
@@ -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.
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -99,17 +103,25 @@ public void setDestinationResolver(DestinationResolver destinationResolver) {
}

/**
* @see AbstractMessageListenerContainer#setErrorHandler(ErrorHandler)
* @see AbstractMessageListenerContainer#setMessageConverter(MessageConverter)
*/
public void setErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
public void setMessageConverter(MessageConverter messageConverter) {
this.messageConverter = messageConverter;
}

/**
* @see AbstractMessageListenerContainer#setMessageConverter(MessageConverter)
* @since 5.2.8
* @see AbstractMessageListenerContainer#setExceptionListener(ExceptionListener)
*/
public void setMessageConverter(MessageConverter messageConverter) {
this.messageConverter = messageConverter;
public void setExceptionListener(ExceptionListener exceptionListener) {
this.exceptionListener = exceptionListener;
}

/**
* @see AbstractMessageListenerContainer#setErrorHandler(ErrorHandler)
*/
public void setErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}

/**
Expand Down Expand Up @@ -182,6 +194,7 @@ public void setAutoStartup(boolean autoStartup) {
this.autoStartup = autoStartup;
}


@Override
public C createListenerContainer(JmsListenerEndpoint endpoint) {
C instance = createContainerInstance();
Expand All @@ -192,12 +205,15 @@ public C createListenerContainer(JmsListenerEndpoint endpoint) {
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);
}
Expand Down

0 comments on commit 165a6f1

Please sign in to comment.