Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/ra/SessionAndProducer.java


1   /** 
2    * 
3    * Copyright 2004 Protique Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  package org.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: 1.1.1.1 $
31   */
32  public interface SessionAndProducer {
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  }