1. /*
  2. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package javax.jms;
  6. /** A <CODE>QueueSession</CODE> object provides methods for creating
  7. * <CODE>QueueReceiver</CODE>, <CODE>QueueSender</CODE>,
  8. * <CODE>QueueBrowser</CODE>, and <CODE>TemporaryQueue</CODE> objects.
  9. *
  10. * <P>If there are messages that have been received but not acknowledged
  11. * when a <CODE>QueueSession</CODE> terminates, these messages will be retained
  12. * and redelivered when a consumer next accesses the queue.
  13. *
  14. * @version 1.0 - 14 May 1998
  15. * @author Mark Hapner
  16. * @author Rich Burridge
  17. *
  18. * @see javax.jms.Session
  19. * @see javax.jms.QueueConnection#createQueueSession(boolean, int)
  20. * @see javax.jms.XAQueueSession#getQueueSession()
  21. */
  22. public interface QueueSession extends Session {
  23. /** Creates a queue identity given a <CODE>Queue</CODE> name.
  24. *
  25. * <P>This facility is provided for the rare cases where clients need to
  26. * dynamically manipulate queue identity. It allows the creation of a
  27. * queue identity with a provider-specific name. Clients that depend
  28. * on this ability are not portable.
  29. *
  30. * <P>Note that this method is not for creating the physical queue.
  31. * The physical creation of queues is an administrative task and is not
  32. * to be initiated by the JMS API. The one exception is the
  33. * creation of temporary queues, which is accomplished with the
  34. * <CODE>createTemporaryQueue</CODE> method.
  35. *
  36. * @param queueName the name of this <CODE>Queue</CODE>
  37. *
  38. * @return a <CODE>Queue</CODE> with the given name
  39. *
  40. * @exception JMSException if the session fails to create a queue
  41. * due to some internal error.
  42. */
  43. Queue
  44. createQueue(String queueName) throws JMSException;
  45. /** Creates a <CODE>QueueReceiver</CODE> object to receive messages from the
  46. * specified queue.
  47. *
  48. * @param queue the <CODE>Queue</CODE> to access
  49. *
  50. * @exception JMSException if the session fails to create a receiver
  51. * due to some internal error.
  52. * @exception InvalidDestinationException if an invalid queue is specified.
  53. */
  54. QueueReceiver
  55. createReceiver(Queue queue) throws JMSException;
  56. /** Creates a <CODE>QueueReceiver</CODE> object to receive messages from the
  57. * specified queue using a message selector.
  58. *
  59. * @param queue the <CODE>Queue</CODE> to access
  60. * @param messageSelector only messages with properties matching the
  61. * message selector expression are delivered. A value of null or
  62. * an empty string indicates that there is no message selector
  63. * for the message consumer.
  64. *
  65. * @exception JMSException if the session fails to create a receiver
  66. * due to some internal error.
  67. * @exception InvalidDestinationException if an invalid queue is specified.
  68. * @exception InvalidSelectorException if the message selector is invalid.
  69. *
  70. */
  71. QueueReceiver
  72. createReceiver(Queue queue,
  73. String messageSelector) throws JMSException;
  74. /** Creates a <CODE>QueueSender</CODE> object to send messages to the
  75. * specified queue.
  76. *
  77. * @param queue the <CODE>Queue</CODE> to access, or null if this is an
  78. * unidentified producer
  79. *
  80. * @exception JMSException if the session fails to create a sender
  81. * due to some internal error.
  82. * @exception InvalidDestinationException if an invalid queue is specified.
  83. */
  84. QueueSender
  85. createSender(Queue queue) throws JMSException;
  86. /** Creates a <CODE>QueueBrowser</CODE> object to peek at the messages on
  87. * the specified queue.
  88. *
  89. * @param queue the <CODE>Queue</CODE> to access
  90. *
  91. * @exception JMSException if the session fails to create a browser
  92. * due to some internal error.
  93. * @exception InvalidDestinationException if an invalid queue is specified.
  94. */
  95. QueueBrowser
  96. createBrowser(Queue queue) throws JMSException;
  97. /** Creates a <CODE>QueueBrowser</CODE> object to peek at the messages on
  98. * the specified queue using a message selector.
  99. *
  100. * @param queue the <CODE>Queue</CODE> to access
  101. * @param messageSelector only messages with properties matching the
  102. * message selector expression are delivered. A value of null or
  103. * an empty string indicates that there is no message selector
  104. * for the message consumer.
  105. *
  106. * @exception JMSException if the session fails to create a browser
  107. * due to some internal error.
  108. * @exception InvalidDestinationException if an invalid queue is specified.
  109. * @exception InvalidSelectorException if the message selector is invalid.
  110. */
  111. QueueBrowser
  112. createBrowser(Queue queue,
  113. String messageSelector) throws JMSException;
  114. /** Creates a <CODE>TemporaryQueue</CODE> object. Its lifetime will be that
  115. * of the <CODE>QueueConnection</CODE> unless it is deleted earlier.
  116. *
  117. * @return a temporary queue identity
  118. *
  119. * @exception JMSException if the session fails to create a temporary queue
  120. * due to some internal error.
  121. */
  122. TemporaryQueue
  123. createTemporaryQueue() throws JMSException;
  124. }