Java Code Examples for javax.resource.spi.endpoint.MessageEndpointFactory#createEndpoint()

The following examples show how to use javax.resource.spi.endpoint.MessageEndpointFactory#createEndpoint() . 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: QuartzResourceAdapter.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Override
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException {

    final Scheduler s = scheduler.get();
    if (null == s) {
        throw new ResourceException("Quartz Scheduler is not available");
    }

    try {

        final JobSpec spec = (JobSpec) activationSpec;

        final MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
        spec.setEndpoint(endpoint);

        final Job job = (Job) endpoint;

        final JobDataMap jobDataMap = spec.getDetail().getJobDataMap();
        jobDataMap.put(Data.class.getName(), new Data(job));

        s.scheduleJob(spec.getDetail(), spec.getTrigger());
    } catch (final SchedulerException e) {
        throw new ResourceException("Failed to schedule job", e);
    }
}
 
Example 2
Source File: SampleResourceAdapter.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec)
        throws ResourceException
{
    final SampleActivationSpec sampleActivationSpec = (SampleActivationSpec) activationSpec;

    try {
        final MessageEndpoint messageEndpoint = messageEndpointFactory.createEndpoint(null);
        final EndpointTarget target = new EndpointTarget(messageEndpoint);
        targets.put(sampleActivationSpec, target);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 3
Source File: SampleResourceAdapter.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec)
        throws ResourceException
{
    final SampleActivationSpec sampleActivationSpec = (SampleActivationSpec) activationSpec;

    try {
        final MessageEndpoint messageEndpoint = messageEndpointFactory.createEndpoint(null);
        final EndpointTarget target = new EndpointTarget(messageEndpoint);
        targets.put(sampleActivationSpec, target);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 4
Source File: SampleResourceAdapter.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec)
        throws ResourceException
{
    final SampleActivationSpec sampleActivationSpec = (SampleActivationSpec) activationSpec;

    try {
        final MessageEndpoint messageEndpoint = messageEndpointFactory.createEndpoint(null);
        final EndpointTarget target = new EndpointTarget(messageEndpoint);
        targets.put(sampleActivationSpec, target);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 5
Source File: MdbConfigTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException {
    assertNotNull("messageEndpointFactory is null", messageEndpointFactory);
    assertNotNull("activationSpec is null", activationSpec);
    assertTrue("activationSpec should be an instance of FakeActivationSpec", activationSpec instanceof FakeActivationSpec);

    final MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
    assertNotNull("endpoint is null", endpoint);
    assertTrue("endpoint should be an instance of FakeMessageListener", endpoint instanceof FakeMessageListener);
}
 
Example 6
Source File: ResourcesJMXTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException {
    final MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
}
 
Example 7
Source File: AutoConfigMdbContainerTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException {
    final EmailAccountInfo accountInfo = (EmailAccountInfo) activationSpec;

    final EmailConsumer emailConsumer = (EmailConsumer) messageEndpointFactory.createEndpoint(null);
    consumers.put(accountInfo.getAddress(), emailConsumer);
}
 
Example 8
Source File: CustomMdbContainerTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException {
    final EmailAccountInfo accountInfo = (EmailAccountInfo) activationSpec;

    final EmailConsumer emailConsumer = (EmailConsumer) messageEndpointFactory.createEndpoint(null);
    consumers.put(accountInfo.getAddress(), emailConsumer);
}
 
Example 9
Source File: NoMessageDeliveryTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException {
    final EmailAccountInfo accountInfo = (EmailAccountInfo) activationSpec;

    final EmailConsumer emailConsumer = (EmailConsumer) messageEndpointFactory.createEndpoint(null);
    consumers.put(accountInfo.getAddress(), emailConsumer);
}