1 /* 2 * Copyright 2002-2005 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springframework.jms.core; 18 19 import javax.jms.JMSException; 20 import javax.jms.Message; 21 22 /** 23 * To be used with JmsTemplate's send method that convert an object to a message. 24 * It allows for further modification of the message after it has been processed 25 * by the converter. This is useful for setting of JMS Header and Properties. 26 * 27 * <p>This often as an anonymous class within a method implementation. 28 * 29 * @author Mark Pollack 30 * @since 1.1 31 * @see JmsTemplate#convertAndSend(String, Object, MessagePostProcessor) 32 * @see JmsTemplate#convertAndSend(javax.jms.Destination, Object, MessagePostProcessor) 33 * @see org.springframework.jms.support.converter.MessageConverter 34 */ 35 public interface MessagePostProcessor { 36 37 /** 38 * Apply a MessagePostProcessor to the message. The returned message is 39 * typically a modified version of the original. 40 * @param message the JMS message from the MessageConverter 41 * @return the modified version of the Message 42 * @throws javax.jms.JMSException if thrown by JMS API methods 43 */ 44 Message postProcessMessage(Message message) throws JMSException; 45 46 } 47