本文整理汇总了Java中javax.resource.spi.endpoint.MessageEndpointFactory类的典型用法代码示例。如果您正苦于以下问题:Java MessageEndpointFactory类的具体用法?Java MessageEndpointFactory怎么用?Java MessageEndpointFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageEndpointFactory类属于javax.resource.spi.endpoint包,在下文中一共展示了MessageEndpointFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endpointActivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
/**
* This is called during the activation of a message endpoint.
*
* @param endpointFactory
* A message endpoint factory instance.
* @param spec
* An activation spec JavaBean instance.
* @throws ResourceException
* generic exception
*/
public void endpointActivation(MessageEndpointFactory endpointFactory,
ActivationSpec spec) throws ResourceException {
if (!equals(spec.getResourceAdapter())) {
throw new ResourceException(
"Activation spec not initialized with this ResourceAdapter instance ("
+ spec.getResourceAdapter() + " != " + this + ")");
}
if (!(spec instanceof RabbitmqActivationSpec)) {
throw new NotSupportedException(
"That type of ActivationSpec not supported: "
+ spec.getClass());
}
RabbitmqActivation activation = new RabbitmqActivation(this,
(RabbitmqActivationSpec) spec, endpointFactory);
activations.put((RabbitmqActivationSpec) spec, activation);
activation.start();
log.tracef("endpointActivation(%s, %s)", endpointFactory, spec);
}
示例2: endpointActivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
/**
* Endpoint activation
*
* @param endpointFactory The endpoint factory
* @param spec The activation spec
* @throws ResourceException Thrown if an error occurs
*/
@Override
public void endpointActivation(final MessageEndpointFactory endpointFactory,
final ActivationSpec spec) throws ResourceException {
if (spec == null) {
throw ActiveMQRABundle.BUNDLE.noActivationSpec();
}
if (!configured.getAndSet(true)) {
try {
setup();
} catch (ActiveMQException e) {
throw new ResourceException("Unable to create activation", e);
}
}
if (logger.isTraceEnabled()) {
logger.trace("endpointActivation(" + endpointFactory + ", " + spec + ")");
}
ActiveMQActivation activation = new ActiveMQActivation(this, endpointFactory, (ActiveMQActivationSpec) spec);
activations.put(spec, activation);
activation.start();
}
示例3: endpointActivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
@Override
public void endpointActivation(MessageEndpointFactory endpointFactory,
ActivationSpec spec)
throws ResourceException {
log.info("[TrafficResourceAdapter] endpointActivation()");
tSpec = (TrafficActivationSpec) spec;
/* New in JCA 1.7 - Get the endpoint class implementation (i.e. the
* MDB class). This allows looking at the MDB implementation for
* annotations. */
Class endpointClass = endpointFactory.getEndpointClass();
tSpec.setBeanClass(endpointClass);
tSpec.findCommandsInMDB();
/* MessageEndpoint msgEndpoint = endpointFactory.createEndpoint(null);
* but we need to do that in a different thread, otherwise the MDB
* never deploys. */
ObtainEndpointWork work = new ObtainEndpointWork(this, endpointFactory);
workManager.scheduleWork(work);
}
示例4: endpointActivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
@Override
public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec activationSpec) throws ResourceException {
FSWatcherActivationSpec fsWatcherAS = (FSWatcherActivationSpec) activationSpec;
try {
WatchKey watchKey = fileSystem.getPath(fsWatcherAS.getDir()).register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
listeners.put(watchKey, endpointFactory);
// On TomEE the endpoint class is available via activationSpec.getBeanClass()
// even though not JavaEE 7 compliant yet!
endpointFactoryToBeanClass.put(
endpointFactory,
fsWatcherAS.getBeanClass() != null ? fsWatcherAS.getBeanClass() : endpointFactory.getEndpointClass());
} catch (IOException e) {
throw new ResourceException(e);
}
}
示例5: endpointDeactivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void endpointDeactivation(MessageEndpointFactory mef, ActivationSpec as) throws Exception
{
if (mef == null)
throw new Exception("MessageEndpointFactory is null");
if (as == null)
throw new Exception("ActivationSpec is null");
Endpoint e = new Endpoint(mef, as);
InflowRecovery ir = activeEndpoints.get(e);
if (ir != null)
ir.deactivate();
try
{
resourceAdapter.endpointDeactivation(mef, as);
}
finally
{
activeEndpoints.remove(e);
}
}
示例6: 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);
}
}
示例7: endpointDeactivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
@Override
public void endpointDeactivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) {
final Scheduler s = scheduler.get();
if (null == s) {
throw new IllegalStateException("Quartz Scheduler is not available");
}
JobSpec spec = null;
try {
spec = (JobSpec) activationSpec;
s.deleteJob(spec.jobKey());
} catch (final SchedulerException e) {
throw new IllegalStateException("Failed to delete job", e);
} finally {
if (null != spec) {
spec.getEndpoint().release();
}
}
}
示例8: createListener
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
private void createListener() throws Exception {
// create the activation spec
final ActiveMQActivationSpec activationSpec = new ActiveMQActivationSpec();
activationSpec.setDestinationType("javax.jms.Queue");
activationSpec.setDestination(REQUEST_QUEUE_NAME);
// validate the activation spec
activationSpec.validate();
// set the resource adapter into the activation spec
activationSpec.setResourceAdapter(ra);
// create the message endpoint
final MessageEndpointFactory endpointFactory = new JmsEndpointFactory();
// activate the endpoint
ra.endpointActivation(endpointFactory, activationSpec);
}
示例9: endpointActivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
/**
* @see ResourceAdapter#endpointActivation(MessageEndpointFactory,ActivationSpec)
*/
@Override
public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec as) throws ResourceException {
this.logger.info("Activating message endpoint with factory " + endpointFactory + " and activation spec " + as);
if (as instanceof KismetActivationSpec) {
// Validate the activation spec first
KismetActivationSpec activationSpec = (KismetActivationSpec) as;
activationSpec.validate();
try {
// Establish a new connection to the given kismet server
KismetServerConnection connection = new KismetServerConnection(activationSpec, endpointFactory);
this.workManager.scheduleWork(connection);
this.connections.add(connection);
}
catch (Throwable cause) {
throw new ResourceException("Failed to establish new connection to kismet server at " + activationSpec.getServerName() + " on port " + activationSpec.getPortNumber(), cause);
}
}
else {
throw new ResourceException("Expected " + KismetActivationSpec.class.getName() + ", but got " + as.getClass().getName());
}
}
示例10: endpointActivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
/**
* This implementation always throws a NotSupportedException.
*/
@Override
public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec)
throws ResourceException {
throw new NotSupportedException("SpringContextResourceAdapter does not support message endpoints");
}
示例11: endpointDeactivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
/**
* This is called when a message endpoint is deactivated.
*
* @param endpointFactory
* A message endpoint factory instance.
* @param spec
* An activation spec JavaBean instance.
*/
public void endpointDeactivation(MessageEndpointFactory endpointFactory,
ActivationSpec spec) {
RabbitmqActivation activation = activations.remove(spec);
if (activation != null)
activation.stop();
log.tracef("endpointDeactivation(%s)", endpointFactory);
}
示例12: RabbitmqMessageHandler
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
public RabbitmqMessageHandler(final RabbitmqResourceAdapter ra,
final RabbitmqActivationSpec spec,
final MessageEndpointFactory endpointFactory,
final Channel channel) throws ResourceException {
super(ra, spec, endpointFactory);
this.channel = channel;
this.spec = spec;
this.ra = ra;
}
示例13: RabbitmqActivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
public RabbitmqActivation(RabbitmqResourceAdapter ra,
RabbitmqActivationSpec spec, MessageEndpointFactory endpointFactory)
throws ResourceException {
super(ra, spec, endpointFactory);
this.ra = ra;
this.spec = spec;
this.endpointFactory = endpointFactory;
}
示例14: RabbitmqExceptionHandler
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
public RabbitmqExceptionHandler(RabbitmqResourceAdapter ra,
RabbitmqActivationSpec spec, MessageEndpointFactory endpointFactory)
throws ResourceException {
this.ra = ra;
this.spec = spec;
this.endpointFactory = endpointFactory;
try {
isDeliveryTransacted = endpointFactory
.isDeliveryTransacted(ONMESSAGE);
} catch (Exception e) {
throw new ResourceException(e);
}
}
示例15: endpointDeactivation
import javax.resource.spi.endpoint.MessageEndpointFactory; //导入依赖的package包/类
/**
* Endpoint deactivation
*
* @param endpointFactory The endpoint factory
* @param spec The activation spec
*/
@Override
public void endpointDeactivation(final MessageEndpointFactory endpointFactory, final ActivationSpec spec) {
if (logger.isTraceEnabled()) {
logger.trace("endpointDeactivation(" + endpointFactory + ", " + spec + ")");
}
ActiveMQActivation activation = activations.remove(spec);
if (activation != null) {
activation.stop();
}
}