Java Doc for MessageProducer.java in  » 6.0-JDK-Modules » JMS » 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 » 6.0 JDK Modules » JMS » javax.jms 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.jms.MessageProducer

MessageProducer
public interface MessageProducer (Code)
A client uses a MessageProducer object to send messages to a destination. A MessageProducer object is created by passing a Destination object to a message-producer creation method supplied by a session.

MessageProducer is the parent interface for all message producers.

A client also has the option of creating a message producer without supplying a destination. In this case, a destination must be provided with every send operation. A typical use for this kind of message producer is to send replies to requests using the request's JMSReplyTo destination.

A client can specify a default delivery mode, priority, and time to live for messages sent by a message producer. It can also specify the delivery mode, priority, and time to live for an individual message.

A client can specify a time-to-live value in milliseconds for each message it sends. This value defines a message expiration time that is the sum of the message's time-to-live and the GMT when it is sent (for transacted sends, this is the time the client sends the message, not the time the transaction is committed).

A JMS provider should do its best to expire messages accurately; however, the JMS API does not define the accuracy provided.
version:
   1.1 - February 2, 2002
author:
   Mark Hapner
author:
   Rich Burridge
author:
   Kate Stout
See Also:   javax.jms.TopicPublisher
See Also:   javax.jms.QueueSender
See Also:   javax.jms.Session.createProducer





Method Summary
 voidclose()
     Closes the message producer.

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

 intgetDeliveryMode()
     Gets the producer's default delivery mode.
 DestinationgetDestination()
     Gets the destination associated with this MessageProducer.
 booleangetDisableMessageID()
     Gets an indication of whether message IDs are disabled.
 booleangetDisableMessageTimestamp()
     Gets an indication of whether message timestamps are disabled.
 intgetPriority()
     Gets the producer's default priority.
 longgetTimeToLive()
     Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
 voidsend(Message message)
     Sends a message using the MessageProducer's default delivery mode, priority, and time to live.
 voidsend(Message message, int deliveryMode, int priority, long timeToLive)
     Sends a message to the destination, specifying delivery mode, priority, and time to live.
 voidsend(Destination destination, Message message)
     Sends a message to a destination for an unidentified message producer. Uses the MessageProducer's default delivery mode, priority, and time to live.

Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.

 voidsend(Destination destination, Message message, int deliveryMode, int priority, long timeToLive)
     Sends a message to a destination for an unidentified message producer, specifying delivery mode, priority and time to live.

Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.

 voidsetDeliveryMode(int deliveryMode)
     Sets the producer's default delivery mode.

Delivery mode is set to PERSISTENT by default.
Parameters:
  deliveryMode - the message delivery mode for this messageproducer; legal values are DeliveryMode.NON_PERSISTENTand DeliveryMode.PERSISTENT
exception:
  JMSException - if the JMS provider fails to set the delivery mode due to some internal error.

 voidsetDisableMessageID(boolean value)
     Sets whether message IDs are disabled.

Since message IDs take some effort to create and increase a message's size, some JMS providers may be able to optimize message overhead if they are given a hint that the message ID is not used by an application.

 voidsetDisableMessageTimestamp(boolean value)
     Sets whether message timestamps are disabled.

Since timestamps take some effort to create and increase a message's size, some JMS providers may be able to optimize message overhead if they are given a hint that the timestamp is not used by an application.

 voidsetPriority(int defaultPriority)
     Sets the producer's default priority.

The JMS API defines ten levels of priority value, with 0 as the lowest priority and 9 as the highest.

 voidsetTimeToLive(long timeToLive)
     Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.



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

Since a provider may allocate some resources on behalf of a MessageProducer 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.
exception:
  JMSException - if the JMS provider fails to close the producerdue to some internal error.




getDeliveryMode
int getDeliveryMode() throws JMSException(Code)
Gets the producer's default delivery mode. the message delivery mode for this message producer
exception:
  JMSException - if the JMS provider fails to get the delivery mode due to some internal error.
See Also:   javax.jms.MessageProducer.setDeliveryMode



getDestination
Destination getDestination() throws JMSException(Code)
Gets the destination associated with this MessageProducer. this producer's Destination/
exception:
  JMSException - if the JMS provider fails to get the destination forthis MessageProducerdue to some internal error.
since:
   1.1



getDisableMessageID
boolean getDisableMessageID() throws JMSException(Code)
Gets an indication of whether message IDs are disabled. an indication of whether message IDs are disabled
exception:
  JMSException - if the JMS provider fails to determine if message IDs are disabled due to some internal error.



getDisableMessageTimestamp
boolean getDisableMessageTimestamp() throws JMSException(Code)
Gets an indication of whether message timestamps are disabled. an indication of whether message timestamps are disabled
exception:
  JMSException - if the JMS provider fails to determine if timestamps are disabled due to some internal error.



getPriority
int getPriority() throws JMSException(Code)
Gets the producer's default priority. the message priority for this message producer
exception:
  JMSException - if the JMS provider fails to get the prioritydue to some internal error.
See Also:   javax.jms.MessageProducer.setPriority



getTimeToLive
long getTimeToLive() throws JMSException(Code)
Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system. the message time to live in milliseconds; zero is unlimited
exception:
  JMSException - if the JMS provider fails to get the time to live due to some internal error.
See Also:   javax.jms.MessageProducer.setTimeToLive



send
void send(Message message) throws JMSException(Code)
Sends a message using the MessageProducer's default delivery mode, priority, and time to live.
Parameters:
  message - the message to send
exception:
  JMSException - if the JMS provider fails to send the message due to some internal error.
exception:
  MessageFormatException - if an invalid message is specified.
exception:
  InvalidDestinationException - if a client usesthis method with a MessageProducer withan invalid destination.
exception:
  java.lang.UnsupportedOperationException - if a client uses thismethod with a MessageProducer that didnot specify a destination at creation time.
See Also:   javax.jms.Session.createProducer
See Also:   
See Also:   javax.jms.MessageProducer
See Also:   
since:
   1.1



send
void send(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException(Code)
Sends a message to the destination, specifying delivery mode, priority, and time to live.
Parameters:
  message - the message to send
Parameters:
  deliveryMode - the delivery mode to use
Parameters:
  priority - the priority for this message
Parameters:
  timeToLive - the message's lifetime (in milliseconds)
exception:
  JMSException - if the JMS provider fails to send the message due to some internal error.
exception:
  MessageFormatException - if an invalid message is specified.
exception:
  InvalidDestinationException - if a client usesthis method with a MessageProducer withan invalid destination.
exception:
  java.lang.UnsupportedOperationException - if a client uses thismethod with a MessageProducer that didnot specify a destination at creation time.
See Also:   javax.jms.Session.createProducer
since:
   1.1



send
void send(Destination destination, Message message) throws JMSException(Code)
Sends a message to a destination for an unidentified message producer. Uses the MessageProducer's default delivery mode, priority, and time to live.

Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.
Parameters:
  destination - the destination to send this message to
Parameters:
  message - the message to send
exception:
  JMSException - if the JMS provider fails to send the message due to some internal error.
exception:
  MessageFormatException - if an invalid message is specified.
exception:
  InvalidDestinationException - if a client usesthis method with an invalid destination.
exception:
  java.lang.UnsupportedOperationException - if a client uses thismethod with a MessageProducer that specified a destination at creation time.
See Also:   javax.jms.Session.createProducer
See Also:   javax.jms.MessageProducer
since:
   1.1




send
void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException(Code)
Sends a message to a destination for an unidentified message producer, specifying delivery mode, priority and time to live.

Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.
Parameters:
  destination - the destination to send this message to
Parameters:
  message - the message to send
Parameters:
  deliveryMode - the delivery mode to use
Parameters:
  priority - the priority for this message
Parameters:
  timeToLive - the message's lifetime (in milliseconds)
exception:
  JMSException - if the JMS provider fails to send the message due to some internal error.
exception:
  MessageFormatException - if an invalid message is specified.
exception:
  InvalidDestinationException - if a client usesthis method with an invalid destination.
See Also:   javax.jms.Session.createProducer
since:
   1.1




setDeliveryMode
void setDeliveryMode(int deliveryMode) throws JMSException(Code)
Sets the producer's default delivery mode.

Delivery mode is set to PERSISTENT by default.
Parameters:
  deliveryMode - the message delivery mode for this messageproducer; legal values are DeliveryMode.NON_PERSISTENTand DeliveryMode.PERSISTENT
exception:
  JMSException - if the JMS provider fails to set the delivery mode due to some internal error.
See Also:   javax.jms.MessageProducer.getDeliveryMode
See Also:   javax.jms.DeliveryMode.NON_PERSISTENT
See Also:   javax.jms.DeliveryMode.PERSISTENT
See Also:   javax.jms.Message.DEFAULT_DELIVERY_MODE




setDisableMessageID
void setDisableMessageID(boolean value) throws JMSException(Code)
Sets whether message IDs are disabled.

Since message IDs take some effort to create and increase a message's size, some JMS providers may be able to optimize message overhead if they are given a hint that the message ID is not used by an application. By calling the setDisableMessageID method on this message producer, a JMS client enables this potential optimization for all messages sent by this message producer. If the JMS provider accepts this hint, these messages must have the message ID set to null; if the provider ignores the hint, the message ID must be set to its normal unique value.

Message IDs are enabled by default.
Parameters:
  value - indicates if message IDs are disabled
exception:
  JMSException - if the JMS provider fails to set message ID todisabled due to some internal error.




setDisableMessageTimestamp
void setDisableMessageTimestamp(boolean value) throws JMSException(Code)
Sets whether message timestamps are disabled.

Since timestamps take some effort to create and increase a message's size, some JMS providers may be able to optimize message overhead if they are given a hint that the timestamp is not used by an application. By calling the setDisableMessageTimestamp method on this message producer, a JMS client enables this potential optimization for all messages sent by this message producer. If the JMS provider accepts this hint, these messages must have the timestamp set to zero; if the provider ignores the hint, the timestamp must be set to its normal value.

Message timestamps are enabled by default.
Parameters:
  value - indicates if message timestamps are disabled
exception:
  JMSException - if the JMS provider fails to set timestamps todisabled due to some internal error.




setPriority
void setPriority(int defaultPriority) throws JMSException(Code)
Sets the producer's default priority.

The JMS API defines ten levels of priority value, with 0 as the lowest priority and 9 as the highest. Clients should consider priorities 0-4 as gradations of normal priority and priorities 5-9 as gradations of expedited priority. Priority is set to 4 by default.
Parameters:
  defaultPriority - the message priority for this message producer;must be a value between 0 and 9
exception:
  JMSException - if the JMS provider fails to set the prioritydue to some internal error.
See Also:   javax.jms.MessageProducer.getPriority
See Also:   javax.jms.Message.DEFAULT_PRIORITY




setTimeToLive
void setTimeToLive(long timeToLive) throws JMSException(Code)
Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.

Time to live is set to zero by default.
Parameters:
  timeToLive - the message time to live in milliseconds; zero isunlimited
exception:
  JMSException - if the JMS provider fails to set the time to live due to some internal error.
See Also:   javax.jms.MessageProducer.getTimeToLive
See Also:   javax.jms.Message.DEFAULT_TIME_TO_LIVE




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