本文整理汇总了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);
}
}
示例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();
}
}
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}