1 /** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one or more 4 * contributor license agreements. See the NOTICE file distributed with 5 * this work for additional information regarding copyright ownership. 6 * The ASF licenses this file to You under the Apache License, Version 2.0 7 * (the "License"); you may not use this file except in compliance with 8 * the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 package org.apache.activemq.ra; 19 20 import javax.jms.JMSException; 21 import javax.jms.MessageProducer; 22 import javax.jms.Session; 23 24 /** 25 * Represents an object which has-a {@link Session} instance and 26 * an optional, lazily created {@link MessageProducer} instance 27 * which can them be used by a pooling based JMS provider for publishing 28 * messages using the session used by the current thread. 29 * 30 * @version $Revision$ 31 */ 32 public interface InboundContext { 33 34 /** 35 * Returns the current session being used to process a JMS message in the current thread. 36 */ 37 public Session getSession() throws JMSException; 38 39 /** 40 * Lazily creates a message producer that can be used to send messages using the 41 * same JMS Session which is being used to dispatch messages which minimises the XA 42 * overheard of consuming and producing or allows JMS transactions to be used for consuming 43 * and producing messages. 44 * 45 * @return the current message producer or a new one is lazily created, using a null 46 * destination so the destination must be specified on a send() method. 47 * @throws javax.jms.JMSException 48 */ 49 public MessageProducer getMessageProducer() throws JMSException; 50 } 51