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>TopicConnection</CODE> object is an active connection to a
  7. * publish/subscribe JMS provider. A client uses a <CODE>TopicConnection</CODE>
  8. * object to create one or more <CODE>TopicSession</CODE> objects
  9. * for producing and consuming messages.
  10. *
  11. * @version 1.0 - 13 March 1998
  12. * @author Mark Hapner
  13. * @author Rich Burridge
  14. *
  15. * @see javax.jms.Connection
  16. * @see javax.jms.TopicConnectionFactory
  17. */
  18. public interface TopicConnection extends Connection {
  19. /** Creates a <CODE>TopicSession</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 topic session
  29. *
  30. * @exception JMSException if the <CODE>TopicConnection</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. TopicSession
  40. createTopicSession(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 topic the topic 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>TopicConnection</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 topic is specified.
  63. * @exception InvalidSelectorException if the message selector is invalid.
  64. * @see javax.jms.ConnectionConsumer
  65. */
  66. ConnectionConsumer
  67. createConnectionConsumer(Topic topic,
  68. String messageSelector,
  69. ServerSessionPool sessionPool,
  70. int maxMessages)
  71. throws JMSException;
  72. /** Create a durable connection consumer for this connection (optional operation).
  73. * This is an expert facility not used by regular JMS clients.
  74. *
  75. * @param topic the topic to access
  76. * @param subscriptionName durable subscription name
  77. * @param messageSelector only messages with properties matching the
  78. * message selector expression are delivered. A value of null or
  79. * an empty string indicates that there is no message selector
  80. * for the message consumer.
  81. * @param sessionPool the server session pool to associate with this
  82. * durable connection consumer
  83. * @param maxMessages the maximum number of messages that can be
  84. * assigned to a server session at one time
  85. *
  86. * @return the durable connection consumer
  87. *
  88. * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
  89. * to create a connection consumer due to some
  90. * internal error or invalid arguments for
  91. * <CODE>sessionPool</CODE> and
  92. * <CODE>messageSelector</CODE>.
  93. * @exception InvalidDestinationException if an invalid topic is specified.
  94. * @exception InvalidSelectorException if the message selector is invalid.
  95. * @see javax.jms.ConnectionConsumer
  96. */
  97. ConnectionConsumer
  98. createDurableConnectionConsumer(Topic topic,
  99. String subscriptionName,
  100. String messageSelector,
  101. ServerSessionPool sessionPool,
  102. int maxMessages)
  103. throws JMSException;
  104. }