001/*
002 * Copyright 2002-2005 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.core;
018
019import javax.jms.JMSException;
020import javax.jms.Message;
021
022/**
023 * To be used with JmsTemplate's send method that convert an object to a message.
024 * It allows for further modification of the message after it has been processed
025 * by the converter. This is useful for setting of JMS Header and Properties.
026 *
027 * <p>This often as an anonymous class within a method implementation.
028 *
029 * @author Mark Pollack
030 * @since 1.1
031 * @see JmsTemplate#convertAndSend(String, Object, MessagePostProcessor)
032 * @see JmsTemplate#convertAndSend(javax.jms.Destination, Object, MessagePostProcessor)
033 * @see org.springframework.jms.support.converter.MessageConverter
034 */
035public interface MessagePostProcessor {
036
037        /**
038         * Apply a MessagePostProcessor to the message. The returned message is
039         * typically a modified version of the original.
040         * @param message the JMS message from the MessageConverter
041         * @return the modified version of the Message
042         * @throws javax.jms.JMSException if thrown by JMS API methods
043         */
044        Message postProcessMessage(Message message) throws JMSException;
045
046}