当前位置: 首页>>代码示例>>Java>>正文


Java MessageEndpointFactory.createEndpoint方法代码示例

本文整理汇总了Java中javax.resource.spi.endpoint.MessageEndpointFactory.createEndpoint方法的典型用法代码示例。如果您正苦于以下问题:Java MessageEndpointFactory.createEndpoint方法的具体用法?Java MessageEndpointFactory.createEndpoint怎么用?Java MessageEndpointFactory.createEndpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.resource.spi.endpoint.MessageEndpointFactory的用法示例。


在下文中一共展示了MessageEndpointFactory.createEndpoint方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: endpointActivation

import javax.resource.spi.endpoint.MessageEndpointFactory; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:26,代码来源:QuartzResourceAdapter.java

示例2: dispatchEvents

import javax.resource.spi.endpoint.MessageEndpointFactory; //导入方法依赖的package包/类
private void dispatchEvents(List<WatchEvent<?>> events, MessageEndpointFactory messageEndpointFactory) {
	for (WatchEvent<?> event: events) {
		Path path = (Path) event.context();

		try {
			MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
			Class<?> beanClass = resourceAdapter.getBeanClass(messageEndpointFactory);
			for (Method m: beanClass.getMethods()) {
				if (StandardWatchEventKinds.ENTRY_CREATE.equals(event.kind()) 
						&& m.isAnnotationPresent(Create.class)
						&& path.toString().matches(m.getAnnotation(Create.class).value())) {
					invoke(endpoint, m, path);
				} else if (StandardWatchEventKinds.ENTRY_DELETE.equals(event.kind()) 
						&& m.isAnnotationPresent(Delete.class)
						&& path.toString().matches(m.getAnnotation(Delete.class).value())) {
					invoke(endpoint, m, path);
				} else if (StandardWatchEventKinds.ENTRY_MODIFY.equals(event.kind()) 
						&& m.isAnnotationPresent(Modify.class)
						&& path.toString().matches(m.getAnnotation(Modify.class).value())) {
					invoke(endpoint, m, path);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:robertpanzer,项目名称:filesystemwatch-connector,代码行数:28,代码来源:FSWatchingThread.java

示例3: endpointActivation

import javax.resource.spi.endpoint.MessageEndpointFactory; //导入方法依赖的package包/类
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();
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:14,代码来源:SampleResourceAdapter.java

示例4: endpointActivation

import javax.resource.spi.endpoint.MessageEndpointFactory; //导入方法依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:tomee,代码行数:10,代码来源:MdbConfigTest.java

示例5: setup

import javax.resource.spi.endpoint.MessageEndpointFactory; //导入方法依赖的package包/类
/**
 * Setup the session
 */
public void setup() throws Exception {
    JmsActivation activation = pool.getActivation();
    JmsActivationSpec spec = activation.getActivationSpec();
    Connection connection = activation.getConnection();
    XAResource xaResource = null;
    tm = activation.getTransactionManager();

    // Get the endpoint
    MessageEndpointFactory endpointFactory = activation.getMessageEndpointFactory();

    // Create the session
    if (activation.isDeliveryTransacted) {
        if (connection instanceof XAConnection) {
            log.debug("Delivery is transacted, and client JMS implementation properly implements javax.jms.XAConnection.");
            xaSession = ((XAConnection) connection).createXASession();
            session = xaSession.getSession();
            xaResource = xaSession.getXAResource();
        } else {
            throw new Exception("Delivery is transacted, but client JMS implementation does not properly implement the necessary interfaces as described in section 8 of the JMS 1.1 specification.");
        }
    } else {
        session = connection.createSession(false, spec.getAcknowledgeModeInt());
    }

    endpoint = endpointFactory.createEndpoint(xaResource);

    // Set the message listener
    session.setMessageListener(this);
}
 
开发者ID:vratsel,项目名称:generic-jms-ra,代码行数:33,代码来源:JmsServerSession.java

示例6: endpointActivation

import javax.resource.spi.endpoint.MessageEndpointFactory; //导入方法依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:tomee,代码行数:7,代码来源:AutoConfigMdbContainerTest.java


注:本文中的javax.resource.spi.endpoint.MessageEndpointFactory.createEndpoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。