Example usage for javax.resource.spi.endpoint MessageEndpoint afterDelivery

List of usage examples for javax.resource.spi.endpoint MessageEndpoint afterDelivery

Introduction

In this page you can find the example usage for javax.resource.spi.endpoint MessageEndpoint afterDelivery.

Prototype

void afterDelivery() throws ResourceException;

Source Link

Document

This is called by a resource adapter after a message is delivered.

Usage

From source file:me.jtalk.socketconnector.SocketResourceAdapter.java

private <T> void sendEndpoint(MessageEndpointFactory factory, Method target, T message) {
    try {/*from www.  jav a2s.  c  o  m*/
        MessageEndpoint endpoint = factory.createEndpoint(null);
        endpoint.beforeDelivery(target);
        try {
            log.trace("Sending endpoint message to ''{}'': prepare", target.getName());

            if (message == null) {
                target.invoke(endpoint);
            } else {
                target.invoke(endpoint, message);
            }

            log.trace("Sending endpoint message to ''{}'': sent", target.getName());
        } catch (IllegalAccessException | InvocationTargetException e) {
            log.error("Exception on message endpoint invocation", e);
        }
        endpoint.afterDelivery();
        endpoint.release();
    } catch (UnavailableException e) {
        log.error("Message endpoint is unavailable", e);
    } catch (ResourceException | NoSuchMethodException e) {
        log.error("Exception on message endpoint processing", e);
    }
}