Skip to content

Commit ae1f26a

Browse files
committed
docs(client): add CompletionListener support documentation for various send methods
1 parent cf2fa9b commit ae1f26a

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageProducer.java

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,16 @@ public void send(Destination destination, Message message, int deliveryMode, int
257257
}
258258

259259
/**
260+
* Sends a message using the default delivery mode, priority and time to live,
261+
* notifying the specified {@code CompletionListener} when the send has completed.
262+
*
263+
* <p><b>Implementation note:</b> the current ActiveMQ Classic implementation performs the
264+
* send synchronously and then invokes the {@code CompletionListener} on a separate thread.
265+
* This is explicitly permitted by the JMS 2.0 specification (section 7.3).
266+
* A future version may implement fully asynchronous sending; application code that follows
267+
* the specification will be compatible with both behaviours.
268+
* For high-throughput asynchronous sending outside the JMS specification, see
269+
* {@link ActiveMQMessageProducer#send(Destination, Message, AsyncCallback)}.
260270
*
261271
* @param message the message to send
262272
* @param completionListener to callback
@@ -280,6 +290,23 @@ public void send(Message message, CompletionListener completionListener) throws
280290
getDisableMessageID(), getDisableMessageTimestamp(), completionListener);
281291
}
282292

293+
/**
294+
* Sends a message with the specified delivery mode, priority and time to live,
295+
* notifying the specified {@code CompletionListener} when the send has completed.
296+
*
297+
* <p><b>Implementation note:</b> the current ActiveMQ Classic implementation performs the
298+
* send synchronously and then invokes the {@code CompletionListener} on a separate thread.
299+
* See {@link #send(Message, CompletionListener)} for details.
300+
*
301+
* @param message the message to send
302+
* @param deliveryMode the delivery mode to use
303+
* @param priority the priority for this message
304+
* @param timeToLive the message's lifetime (in milliseconds)
305+
* @param completionListener to callback
306+
* @throws JMSException if the JMS provider fails to send the message due to some internal error.
307+
* @throws UnsupportedOperationException if called on an anonymous producer (no fixed destination)
308+
* @since 2.0
309+
*/
283310
@Override
284311
public void send(Message message, int deliveryMode, int priority, long timeToLive,
285312
CompletionListener completionListener) throws JMSException {
@@ -296,6 +323,23 @@ public void send(Message message, int deliveryMode, int priority, long timeToLiv
296323
getDisableMessageID(), getDisableMessageTimestamp(), completionListener);
297324
}
298325

326+
/**
327+
* Sends a message to the specified destination using the default delivery mode, priority
328+
* and time to live, notifying the specified {@code CompletionListener} when the send
329+
* has completed.
330+
*
331+
* <p><b>Implementation note:</b> the current ActiveMQ Classic implementation performs the
332+
* send synchronously and then invokes the {@code CompletionListener} on a separate thread.
333+
* See {@link #send(Message, CompletionListener)} for details.
334+
*
335+
* @param destination the destination to send this message to
336+
* @param message the message to send
337+
* @param completionListener to callback
338+
* @throws JMSException if the JMS provider fails to send the message due to some internal error.
339+
* @throws UnsupportedOperationException if called on a producer with a fixed destination
340+
* @throws InvalidDestinationException if a null destination is specified
341+
* @since 2.0
342+
*/
299343
@Override
300344
public void send(Destination destination, Message message, CompletionListener completionListener) throws JMSException {
301345
checkClosed();
@@ -313,6 +357,26 @@ public void send(Destination destination, Message message, CompletionListener co
313357
getDisableMessageID(), getDisableMessageTimestamp(), completionListener);
314358
}
315359

360+
/**
361+
* Sends a message to the specified destination with the specified delivery mode, priority
362+
* and time to live, notifying the specified {@code CompletionListener} when the send
363+
* has completed.
364+
*
365+
* <p><b>Implementation note:</b> the current ActiveMQ Classic implementation performs the
366+
* send synchronously and then invokes the {@code CompletionListener} on a separate thread.
367+
* See {@link #send(Message, CompletionListener)} for details.
368+
*
369+
* @param destination the destination to send this message to
370+
* @param message the message to send
371+
* @param deliveryMode the delivery mode to use
372+
* @param priority the priority for this message
373+
* @param timeToLive the message's lifetime (in milliseconds)
374+
* @param completionListener to callback
375+
* @throws JMSException if the JMS provider fails to send the message due to some internal error.
376+
* @throws UnsupportedOperationException if called on a producer with a fixed destination
377+
* @throws InvalidDestinationException if a null destination is specified
378+
* @since 2.0
379+
*/
316380
@Override
317381
public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive,
318382
CompletionListener completionListener) throws JMSException {
@@ -333,6 +397,26 @@ public void send(Destination destination, Message message, int deliveryMode, int
333397
getDisableMessageID(), getDisableMessageTimestamp(), completionListener);
334398
}
335399

400+
/**
401+
* Sends a message to the specified destination with full control over delivery parameters,
402+
* notifying the specified {@code CompletionListener} when the send has completed.
403+
*
404+
* <p><b>Implementation note:</b> the current ActiveMQ Classic implementation performs the
405+
* send synchronously and then invokes the {@code CompletionListener} on a separate thread.
406+
* See {@link #send(Message, CompletionListener)} for details.
407+
*
408+
* @param destination the destination to send this message to
409+
* @param message the message to send
410+
* @param deliveryMode the delivery mode to use
411+
* @param priority the priority for this message
412+
* @param timeToLive the message's lifetime (in milliseconds)
413+
* @param disableMessageID whether to disable setting the message ID
414+
* @param disableMessageTimestamp whether to disable setting the message timestamp
415+
* @param completionListener to callback
416+
* @throws JMSException if the JMS provider fails to send the message due to some internal error.
417+
* @throws UnsupportedOperationException if called on a producer with a fixed destination
418+
* @throws InvalidDestinationException if a null destination is specified
419+
*/
336420
public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive,
337421
boolean disableMessageID, boolean disableMessageTimestamp,
338422
CompletionListener completionListener) throws JMSException {

0 commit comments

Comments
 (0)