Java Doc for MessageConsumer.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.MessageConsumer

MessageConsumer
public interface MessageConsumer (Code)
A client uses a MessageConsumer object to receive messages from a destination. A MessageConsumer object is created by passing a Destination object to a message-consumer creation method supplied by a session.

MessageConsumer is the parent interface for all message consumers.

A message consumer can be created with a message selector. A message selector allows the client to restrict the messages delivered to the message consumer to those that match the selector.

A client may either synchronously receive a message consumer's messages or have the consumer asynchronously deliver them as they arrive.

For synchronous receipt, a client can request the next message from a message consumer using one of its receive methods. There are several variations of receive that allow a client to poll or wait for the next message.

For asynchronous delivery, a client can register a MessageListener object with a message consumer. As messages arrive at the message consumer, it delivers them by calling the MessageListener's onMessage method.

It is a client programming error for a MessageListener to throw an exception.
See Also:   javax.jms.QueueReceiver
See Also:   javax.jms.TopicSubscriber
See Also:   javax.jms.Session





Method Summary
 voidclose()
     Closes the message consumer.

Since a provider may allocate some resources on behalf of a MessageConsumer outside the Java virtual machine, clients should close them when they are not needed.

 MessageListenergetMessageListener()
     Gets the message consumer's MessageListener.
 StringgetMessageSelector()
     Gets this message consumer's message selector expression.
 Messagereceive()
     Receives the next message produced for this message consumer.
 Messagereceive(long timeout)
     Receives the next message that arrives within the specified timeout interval.
 MessagereceiveNoWait()
     Receives the next message if one is immediately available.
 voidsetMessageListener(MessageListener listener)
     Sets the message consumer's MessageListener.



Method Detail
close
void close() throws JMSException(Code)
Closes the message consumer.

Since a provider may allocate some resources on behalf of a MessageConsumer outside the Java virtual machine, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

This call blocks until a receive or message listener in progress has completed. A blocked message consumer receive call returns null when this message consumer is closed.
exception:
  JMSException - if the JMS provider fails to close the consumerdue to some internal error.




getMessageListener
MessageListener getMessageListener() throws JMSException(Code)
Gets the message consumer's MessageListener. the listener for the message consumer, or null if no listeneris set
exception:
  JMSException - if the JMS provider fails to get the messagelistener due to some internal error.
See Also:   javax.jms.MessageConsumer.setMessageListener



getMessageSelector
String getMessageSelector() throws JMSException(Code)
Gets this message consumer's message selector expression. this message consumer's message selector, or null if nomessage selector exists for the message consumer (that is, if the message selector was not set or was set to null or the empty string)
exception:
  JMSException - if the JMS provider fails to get the messageselector due to some internal error.



receive
Message receive() throws JMSException(Code)
Receives the next message produced for this message consumer.

This call blocks indefinitely until a message is produced or until this message consumer is closed.

If this receive is done within a transaction, the consumer retains the message until the transaction commits. the next message produced for this message consumer, or null if this message consumer is concurrently closed
exception:
  JMSException - if the JMS provider fails to receive the nextmessage due to some internal error.




receive
Message receive(long timeout) throws JMSException(Code)
Receives the next message that arrives within the specified timeout interval.

This call blocks until a message arrives, the timeout expires, or this message consumer is closed. A timeout of zero never expires, and the call blocks indefinitely.
Parameters:
  timeout - the timeout value (in milliseconds) the next message produced for this message consumer, or null if the timeout expires or this message consumer is concurrently closed
exception:
  JMSException - if the JMS provider fails to receive the nextmessage due to some internal error.




receiveNoWait
Message receiveNoWait() throws JMSException(Code)
Receives the next message if one is immediately available. the next message produced for this message consumer, or null if one is not available
exception:
  JMSException - if the JMS provider fails to receive the nextmessage due to some internal error.



setMessageListener
void setMessageListener(MessageListener listener) throws JMSException(Code)
Sets the message consumer's MessageListener.

Setting the message listener to null is the equivalent of unsetting the message listener for the message consumer.

The effect of calling MessageConsumer.setMessageListener while messages are being consumed by an existing listener or the consumer is being used to consume messages synchronously is undefined.
Parameters:
  listener - the listener to which the messages are to be delivered
exception:
  JMSException - if the JMS provider fails to set the messagelistener due to some internal error.
See Also:   javax.jms.MessageConsumer.getMessageListener




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