001/*
002 * Copyright 2012-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.autoconfigure.amqp;
018
019import org.springframework.amqp.rabbit.core.RabbitTemplate;
020import org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer;
021import org.springframework.retry.support.RetryTemplate;
022
023/**
024 * Callback interface that can be used to customize a {@link RetryTemplate} used as part
025 * of the Rabbit infrastructure.
026 *
027 * @author Stephane Nicoll
028 * @since 2.1.0
029 */
030@FunctionalInterface
031public interface RabbitRetryTemplateCustomizer {
032
033        /**
034         * Callback to customize a {@link RetryTemplate} instance used in the context of the
035         * specified {@link Target}.
036         * @param target the {@link Target} of the retry template
037         * @param retryTemplate the template to customize
038         */
039        void customize(Target target, RetryTemplate retryTemplate);
040
041        /**
042         * Define the available target for a {@link RetryTemplate}.
043         */
044        enum Target {
045
046                /**
047                 * {@link RabbitTemplate} target.
048                 */
049                SENDER,
050
051                /**
052                 * {@link AbstractMessageListenerContainer} target.
053                 */
054                LISTENER
055
056        }
057
058}