Java Code Examples for javax.resource.spi.endpoint.MessageEndpoint#afterDelivery()

The following examples show how to use javax.resource.spi.endpoint.MessageEndpoint#afterDelivery() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestActivation.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Start the activation
 * @throws ResourceException Thrown if an error occurs
 */
public void start() throws ResourceException
{
   try
   {
      Method m = TestMessageListener.class.getMethod("onMessage", new Class<?>[] {String.class});
      
      MessageEndpoint me = endpointFactory.createEndpoint(null);
      me.beforeDelivery(m);

      TestMessageListener tml = (TestMessageListener)me;
      tml.onMessage(spec.getName());
      
      me.afterDelivery();
      me.release();
   }
   catch (ResourceException re)
   {
      throw re;
   }
   catch (Exception e)
   {
      throw new ResourceException(e);
   }
}
 
Example 2
Source File: AutoConfigMdbContainerTest.java    From tomee with Apache License 2.0 3 votes vote down vote up
public void deliverEmail(final Properties headers, final String body) throws Exception {
    final String to = headers.getProperty("To");

    final EmailConsumer emailConsumer = consumers.get(to);

    if (emailConsumer == null) throw new Exception("No such account");

    final MessageEndpoint endpoint = (MessageEndpoint) emailConsumer;

    endpoint.beforeDelivery(EmailConsumer.class.getMethod("receiveEmail", Properties.class, String.class));
    emailConsumer.receiveEmail(headers, body);
    endpoint.afterDelivery();
}
 
Example 3
Source File: CustomMdbContainerTest.java    From tomee with Apache License 2.0 3 votes vote down vote up
public void deliverEmail(final Properties headers, final String body) throws Exception {
    final String to = headers.getProperty("To");

    final EmailConsumer emailConsumer = consumers.get(to);

    if (emailConsumer == null) throw new Exception("No such account");

    final MessageEndpoint endpoint = (MessageEndpoint) emailConsumer;

    endpoint.beforeDelivery(EmailConsumer.class.getMethod("receiveEmail", Properties.class, String.class));
    emailConsumer.receiveEmail(headers, body);
    endpoint.afterDelivery();
}
 
Example 4
Source File: NoMessageDeliveryTest.java    From tomee with Apache License 2.0 3 votes vote down vote up
public void deliverEmail(final Properties headers, final String body) throws Exception {
    final String to = headers.getProperty("To");

    final EmailConsumer emailConsumer = consumers.get(to);

    if (emailConsumer == null) throw new Exception("No such account");

    final MessageEndpoint endpoint = (MessageEndpoint) emailConsumer;

    endpoint.beforeDelivery(EmailConsumer.class.getMethod("receiveEmail", Properties.class, String.class));
    endpoint.afterDelivery();
}