001/* 002 * Copyright 2002-2014 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.config; 018 019import javax.jms.MessageListener; 020 021import org.springframework.jms.listener.MessageListenerContainer; 022 023/** 024 * A {@link JmsListenerEndpoint} simply providing the {@link MessageListener} to 025 * invoke to process an incoming message for this endpoint. 026 * 027 * @author Stephane Nicoll 028 * @since 4.1 029 */ 030public class SimpleJmsListenerEndpoint extends AbstractJmsListenerEndpoint { 031 032 private MessageListener messageListener; 033 034 035 /** 036 * Set the {@link MessageListener} to invoke when a message matching 037 * the endpoint is received. 038 */ 039 public void setMessageListener(MessageListener messageListener) { 040 this.messageListener = messageListener; 041 } 042 043 /** 044 * Return the {@link MessageListener} to invoke when a message matching 045 * the endpoint is received. 046 */ 047 public MessageListener getMessageListener() { 048 return this.messageListener; 049 } 050 051 052 @Override 053 protected MessageListener createMessageListener(MessageListenerContainer container) { 054 return getMessageListener(); 055 } 056 057 @Override 058 protected StringBuilder getEndpointDescription() { 059 return super.getEndpointDescription() 060 .append(" | messageListener='").append(this.messageListener).append("'"); 061 } 062 063}