001/*
002 * Copyright 2002-2017 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 *      https://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.jms.listener;
018
019import org.springframework.context.SmartLifecycle;
020import org.springframework.jms.support.QosSettings;
021import org.springframework.jms.support.converter.MessageConverter;
022import org.springframework.jms.support.destination.DestinationResolver;
023import org.springframework.lang.Nullable;
024
025/**
026 * Internal abstraction used by the framework representing a message
027 * listener container. Not meant to be implemented externally with
028 * support for both JMS and JCA style containers.
029 *
030 * @author Stephane Nicoll
031 * @since 4.1
032 */
033public interface MessageListenerContainer extends SmartLifecycle {
034
035        /**
036         * Setup the message listener to use. Throws an {@link IllegalArgumentException}
037         * if that message listener type is not supported.
038         */
039        void setupMessageListener(Object messageListener);
040
041        /**
042         * Return the {@link MessageConverter} that can be used to
043         * convert {@link javax.jms.Message}, if any.
044         */
045        @Nullable
046        MessageConverter getMessageConverter();
047
048        /**
049         * Return the {@link DestinationResolver} to use to resolve
050         * destinations by names.
051         */
052        @Nullable
053        DestinationResolver getDestinationResolver();
054
055        /**
056         * Return whether the Publish/Subscribe domain ({@link javax.jms.Topic Topics}) is used.
057         * Otherwise, the Point-to-Point domain ({@link javax.jms.Queue Queues}) is used.
058         */
059        boolean isPubSubDomain();
060
061        /**
062         * Return whether the reply destination uses Publish/Subscribe domain
063         * ({@link javax.jms.Topic Topics}). Otherwise, the Point-to-Point domain
064         * ({@link javax.jms.Queue Queues}) is used.
065         * <p>By default, the value is identical to {@link #isPubSubDomain()}.
066         */
067        boolean isReplyPubSubDomain();
068
069        /**
070         * Return the {@link QosSettings} to use when sending a reply,
071         * or {@code null} if the broker's defaults should be used.
072         * @since 5.0
073         */
074        @Nullable
075        QosSettings getReplyQosSettings();
076
077}