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>QueueConnection</CODE> object is an active connection to a
  7. * point-to-point JMS provider. A client uses a <CODE>QueueConnection</CODE>
  8. * object to create one or more <CODE>QueueSession</CODE> objects
  9. * for producing and consuming messages.
  10. *
  11. * @version 1.0 - 3 August 1998
  12. * @author Mark Hapner
  13. * @author Rich Burridge
  14. *
  15. * @see javax.jms.Connection
  16. * @see javax.jms.QueueConnectionFactory
  17. */
  18. public interface QueueConnection extends Connection {
  19. /** Creates a <CODE>QueueSession</CODE> object.
  20. *
  21. * @param transacted indicates whether the session is transacted
  22. * @param acknowledgeMode indicates whether the consumer or the
  23. * client will acknowledge any messages it receives; ignored if the session
  24. * is transacted. Legal values are <code>Session.AUTO_ACKNOWLEDGE</code>,
  25. * <code>Session.CLIENT_ACKNOWLEDGE</code>, and
  26. * <code>Session.DUPS_OK_ACKNOWLEDGE</code>.
  27. *
  28. * @return a newly created queue session
  29. *
  30. * @exception JMSException if the <CODE>QueueConnection</CODE> object fails
  31. * to create a session due to some internal error or
  32. * lack of support for the specific transaction
  33. * and acknowledgement mode.
  34. *
  35. * @see Session#AUTO_ACKNOWLEDGE
  36. * @see Session#CLIENT_ACKNOWLEDGE
  37. * @see Session#DUPS_OK_ACKNOWLEDGE
  38. */
  39. QueueSession
  40. createQueueSession(boolean transacted,
  41. int acknowledgeMode) throws JMSException;
  42. /** Creates a connection consumer for this connection (optional operation).
  43. * This is an expert facility not used by regular JMS clients.
  44. *
  45. * @param queue the queue to access
  46. * @param messageSelector only messages with properties matching the
  47. * message selector expression are delivered. A value of null or
  48. * an empty string indicates that there is no message selector
  49. * for the message consumer.
  50. * @param sessionPool the server session pool to associate with this
  51. * connection consumer
  52. * @param maxMessages the maximum number of messages that can be
  53. * assigned to a server session at one time
  54. *
  55. * @return the connection consumer
  56. *
  57. * @exception JMSException if the <CODE>QueueConnection</CODE> object fails
  58. * to create a connection consumer due to some
  59. * internal error or invalid arguments for
  60. * <CODE>sessionPool</CODE> and
  61. * <CODE>messageSelector</CODE>.
  62. * @exception InvalidDestinationException if an invalid queue is specified.
  63. * @exception InvalidSelectorException if the message selector is invalid.
  64. * @see javax.jms.ConnectionConsumer
  65. */
  66. ConnectionConsumer
  67. createConnectionConsumer(Queue queue,
  68. String messageSelector,
  69. ServerSessionPool sessionPool,
  70. int maxMessages)
  71. throws JMSException;
  72. }