public class SendNotification extends Object implements Closeable
While the transport sender are not expected to instantiate instances of this class the
SendCallback.register(XMessageContext, long)
method should be used to acquire
a notification instance, which should be closed after its use. Also note that for the completion to work properly
the SendCallback should be registered with the transport sender such that the sender implementation calls
the respective complete method for the notifications to work properly
The usage pattern of this class within a transport sender would be
try (SendNotification sendNotification = sendCallback.register(messageContext)) { // ..sending logic sendNotification.waitForCompletion(); }
Or in prior to Java 7
SendNotification sendNotification = sendCallback.register(messageContext); try { // ..sending logic sendNotification.waitForCompletion(); } finally { try { sendNotification.close(); } catch (IOException ignore) {} }
Constructor and Description |
---|
SendNotification(SendCallback sendCallback,
XMessageContext messageContext,
long timeout) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the Send notification and removes the notification from the send callback
|
(package private) void |
complete()
Completes the callback.
|
(package private) void |
recordError(Exception e)
Notifies and error.
|
boolean |
waitForCompletion()
This method waits for the completion notification from the transport sender is reached to the ESB to proceed
|
SendNotification(SendCallback sendCallback, XMessageContext messageContext, long timeout)
public boolean waitForCompletion()
true
else it is false
void recordError(Exception e)
SendCallback
hence the
access modified being used as package locale
- the exception that needs to be recordedvoid complete()
SendCallback
hence the
access modified being used as package localpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- this is inherited from the interface and is never thrown by this methodCopyright © 2016–2019 AdroitLogic. All rights reserved.