Java Doc for TopicSession.java in  » EJB-Server-JBoss-4.2.1 » j2ee » javax » jms » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » j2ee » javax.jms 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.jms.TopicSession

TopicSession
public interface TopicSession extends Session(Code)
A TopicSession object provides methods for creating TopicPublisher, TopicSubscriber, and TemporaryTopic objects. It also provides a method for deleting its client's durable subscribers.

A TopicSession is used for creating Pub/Sub specific objects. In general, use the Session object, and use TopicSession only to support existing code. Using the Session object simplifies the programming model, and allows transactions to be used across the two messaging domains.

A TopicSession cannot be used to create objects specific to the point-to-point domain. The following methods inherit from Session, but must throw an IllegalStateException if used from TopicSession:

  • createBrowser
  • createQueue
  • createTemporaryQueue

See Also:   javax.jms.Session
See Also:   javax.jms.Connection.createSession(booleanint)
See Also:   javax.jms.TopicConnection.createTopicSession(booleanint)
See Also:   javax.jms.XATopicSession.getTopicSession




Method Summary
 TopicSubscribercreateDurableSubscriber(Topic topic, String name)
     Creates a durable subscriber to the specified topic.

If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable TopicSubscriber.

 TopicSubscribercreateDurableSubscriber(Topic topic, String name, String messageSelector, boolean noLocal)
     Creates a durable subscriber to the specified topic, using a message selector or specifying whether messages published by its own connection should be delivered to it.

If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable TopicSubscriber.

 TopicPublishercreatePublisher(Topic topic)
     Creates a publisher for the specified topic.
 TopicSubscribercreateSubscriber(Topic topic)
     Creates a nondurable subscriber to the specified topic.

A client uses a TopicSubscriber object to receive messages that have been published to a topic.

Regular TopicSubscriber objects are not durable.

 TopicSubscribercreateSubscriber(Topic topic, String messageSelector, boolean noLocal)
     Creates a nondurable subscriber to the specified topic, using a message selector or specifying whether messages published by its own connection should be delivered to it.

A client uses a TopicSubscriber object to receive messages that have been published to a topic.

Regular TopicSubscriber objects are not durable.

 TemporaryTopiccreateTemporaryTopic()
     Creates a TemporaryTopic object.
 TopiccreateTopic(String topicName)
     Creates a topic identity given a Topic name.

This facility is provided for the rare cases where clients need to dynamically manipulate topic identity.

 voidunsubscribe(String name)
     Unsubscribes a durable subscription that has been created by a client.



Method Detail
createDurableSubscriber
TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException(Code)
Creates a durable subscriber to the specified topic.

If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable TopicSubscriber. The JMS provider retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are acknowledged by this durable subscriber or they have expired.

Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name that uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have a TopicSubscriber for a particular durable subscription.

A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing (deleting) the old one and creating a new one.

In some cases, a connection may both publish and subscribe to a topic. The subscriber NoLocal attribute allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this attribute is false.
Parameters:
  topic - the non-temporary Topic to subscribe to
Parameters:
  name - the name used to identify this subscription
exception:
  JMSException - if the session fails to create a subscriberdue to some internal error.
exception:
  InvalidDestinationException - if an invalid topic is specified.




createDurableSubscriber
TopicSubscriber createDurableSubscriber(Topic topic, String name, String messageSelector, boolean noLocal) throws JMSException(Code)
Creates a durable subscriber to the specified topic, using a message selector or specifying whether messages published by its own connection should be delivered to it.

If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable TopicSubscriber. The JMS provider retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are acknowledged by this durable subscriber or they have expired.

Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name which uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have a TopicSubscriber for a particular durable subscription. An inactive durable subscriber is one that exists but does not currently have a message consumer associated with it.

A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing (deleting) the old one and creating a new one.
Parameters:
  topic - the non-temporary Topic to subscribe to
Parameters:
  name - the name used to identify this subscription
Parameters:
  messageSelector - only messages with properties matching themessage selector expression are delivered. A value of null oran empty string indicates that there is no message selector for the message consumer.
Parameters:
  noLocal - if set, inhibits the delivery of messages publishedby its own connection
exception:
  JMSException - if the session fails to create a subscriberdue to some internal error.
exception:
  InvalidDestinationException - if an invalid topic is specified.
exception:
  InvalidSelectorException - if the message selector is invalid.




createPublisher
TopicPublisher createPublisher(Topic topic) throws JMSException(Code)
Creates a publisher for the specified topic.

A client uses a TopicPublisher object to publish messages on a topic. Each time a client creates a TopicPublisher on a topic, it defines a new sequence of messages that have no ordering relationship with the messages it has previously sent.
Parameters:
  topic - the Topic to publish to, or null if this is anunidentified producer
exception:
  JMSException - if the session fails to create a publisherdue to some internal error.
exception:
  InvalidDestinationException - if an invalid topic is specified.




createSubscriber
TopicSubscriber createSubscriber(Topic topic) throws JMSException(Code)
Creates a nondurable subscriber to the specified topic.

A client uses a TopicSubscriber object to receive messages that have been published to a topic.

Regular TopicSubscriber objects are not durable. They receive only messages that are published while they are active.

In some cases, a connection may both publish and subscribe to a topic. The subscriber NoLocal attribute allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this attribute is false.
Parameters:
  topic - the Topic to subscribe to
exception:
  JMSException - if the session fails to create a subscriberdue to some internal error.
exception:
  InvalidDestinationException - if an invalid topic is specified.




createSubscriber
TopicSubscriber createSubscriber(Topic topic, String messageSelector, boolean noLocal) throws JMSException(Code)
Creates a nondurable subscriber to the specified topic, using a message selector or specifying whether messages published by its own connection should be delivered to it.

A client uses a TopicSubscriber object to receive messages that have been published to a topic.

Regular TopicSubscriber objects are not durable. They receive only messages that are published while they are active.

Messages filtered out by a subscriber's message selector will never be delivered to the subscriber. From the subscriber's perspective, they do not exist.

In some cases, a connection may both publish and subscribe to a topic. The subscriber NoLocal attribute allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this attribute is false.
Parameters:
  topic - the Topic to subscribe to
Parameters:
  messageSelector - only messages with properties matching themessage selector expression are delivered. A value of null oran empty string indicates that there is no message selector for the message consumer.
Parameters:
  noLocal - if set, inhibits the delivery of messages publishedby its own connection
exception:
  JMSException - if the session fails to create a subscriberdue to some internal error.
exception:
  InvalidDestinationException - if an invalid topic is specified.
exception:
  InvalidSelectorException - if the message selector is invalid.




createTemporaryTopic
TemporaryTopic createTemporaryTopic() throws JMSException(Code)
Creates a TemporaryTopic object. Its lifetime will be that of the TopicConnection unless it is deleted earlier. a temporary topic identity
exception:
  JMSException - if the session fails to create a temporarytopic due to some internal error.



createTopic
Topic createTopic(String topicName) throws JMSException(Code)
Creates a topic identity given a Topic name.

This facility is provided for the rare cases where clients need to dynamically manipulate topic identity. This allows the creation of a topic identity with a provider-specific name. Clients that depend on this ability are not portable.

Note that this method is not for creating the physical topic. The physical creation of topics is an administrative task and is not to be initiated by the JMS API. The one exception is the creation of temporary topics, which is accomplished with the createTemporaryTopic method.
Parameters:
  topicName - the name of this Topic a Topic with the given name
exception:
  JMSException - if the session fails to create a topicdue to some internal error.




unsubscribe
void unsubscribe(String name) throws JMSException(Code)
Unsubscribes a durable subscription that has been created by a client.

This method deletes the state being maintained on behalf of the subscriber by its provider.

It is erroneous for a client to delete a durable subscription while there is an active TopicSubscriber for the subscription, or while a consumed message is part of a pending transaction or has not been acknowledged in the session.
Parameters:
  name - the name used to identify this subscription
exception:
  JMSException - if the session fails to unsubscribe to the durable subscription due to some internal error.
exception:
  InvalidDestinationException - if an invalid subscription nameis specified.




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.