![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
• Synchronous sending blocks the application thread until the entire send is complete.
• Asynchronous sending offloads the notification of the success or failure to another thread, thereby increasing performance in certain situations.
• Non-Persistent Messages When high performance is a concern, use synchronous sending for non-persistent or reliable messages. Although asynchronous sending of non-persistent messages is supported, it is generally not recommended.
• Transactions Typically, it makes sense for applications to use synchronous sending when using transactions. Sending messages within a transaction does not require a response from the server, so higher throughput can be obtained sending synchronously within a transaction.See Sending Messages for details.The message producer can send messages asynchronously by registering a completion listener to monitor message send success or failure. Operating in a thread separate from that of the message producer, the completion listener manages the response to a successful or failed send, leaving the message producer free to perform other operations. See Creating a Completion Listener for Asynchronous Sending for details.For simplicity, it is suggested that application programmers create a new message for every asynchronous send call. If concurrent message use is acceptable in an application, messages may be reused when sending asynchronously, but generally it is not recommended due to the complexity it may add.
For example, if a TextMessage is asynchronously sent with the text of foo, and then the same message object's text is subsequently set to bar, it is conceivable that when the completion listener is invoked the message will contain bar even though it contained foo at the time it was sent.
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |