Top Description Inners Fields Constructors Methods
org.springframework.jca.endpoint

public Class GenericMessageEndpointFactory

extends AbstractMessageEndpointFactory
Class Inheritance
Imports
javax.transaction.xa.XAResource, jakarta.resource.ResourceException, jakarta.resource.spi.UnavailableException, jakarta.resource.spi.endpoint.MessageEndpoint, org.aopalliance.intercept.MethodInterceptor, .MethodInvocation, org.springframework.aop.framework.ProxyFactory, org.springframework.aop.support.DelegatingIntroductionInterceptor, org.springframework.lang.Nullable, org.springframework.util.Assert, .ReflectionUtils

Generic implementation of the JCA 1.7 jakarta.resource.spi.endpoint.MessageEndpointFactory interface, providing transaction management capabilities for any kind of message listener object (e.g. jakarta.jms.MessageListener objects or jakarta.resource.cci.MessageListener objects).

Uses AOP proxies for concrete endpoint instances, simply wrapping the specified message listener object and exposing all of its implemented interfaces on the endpoint instance.

Typically used with Spring's GenericMessageEndpointManager, but not tied to it. As a consequence, this endpoint factory could also be used with programmatic endpoint management on a native jakarta.resource.spi.ResourceAdapter instance.

Author
Juergen Hoeller
Since
2.5
See Also
setMessageListener, setTransactionManager, GenericMessageEndpointManager

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
GenericMessageEndpointFactory.GenericMessageEndpoint

Private inner class that implements the concrete generic message endpoint, as an AOP Alliance MethodInterceptor that will be invoked by a proxy.

public static class
GenericMessageEndpointFactory.InternalResourceException

Internal exception thrown when a ResourceException has been encountered during the endpoint invocation.

Field Summary

Modifier and TypeField and Description
private Object
Inherited from org.springframework.jca.endpoint.AbstractMessageEndpointFactory:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public MessageEndpoint
createEndpoint(XAResource
an optional XAResource instance used to get transaction notifications when the message delivery is transacted.
xaResource
)

Overrides org.springframework.jca.endpoint.AbstractMessageEndpointFactory.createEndpoint.

Implements jakarta.resource.spi.endpoint.MessageEndpointFactory.createEndpoint.

Wrap each concrete endpoint instance with an AOP proxy, exposing the message listener's interfaces as well as the endpoint SPI through an AOP introduction.

protected AbstractMessageEndpointFactory.AbstractMessageEndpoint
createEndpointInternal()

Implements abstract org.springframework.jca.endpoint.AbstractMessageEndpointFactory.createEndpointInternal.

Creates a concrete generic message endpoint, internal to this factory.

protected Object
getMessageListener()

Return the message listener object for this endpoint.

public void
setMessageListener(Object messageListener)

Specify the message listener object that the endpoint should expose (e.g. a jakarta.jms.MessageListener objects or jakarta.resource.cci.MessageListener implementation).

Inherited from org.springframework.jca.endpoint.AbstractMessageEndpointFactory:
createEndpointgetActivationNamegetEndpointClassisDeliveryTransactedsetBeanNamesetTransactionFactorysetTransactionManagersetTransactionNamesetTransactionTimeout

Field Detail

messageListenerback to summary
private Object messageListener
Annotations
@Nullable

Constructor Detail

GenericMessageEndpointFactoryback to summary
public GenericMessageEndpointFactory()

Method Detail

createEndpointback to summary
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException

Overrides org.springframework.jca.endpoint.AbstractMessageEndpointFactory.createEndpoint.

Implements jakarta.resource.spi.endpoint.MessageEndpointFactory.createEndpoint.

Wrap each concrete endpoint instance with an AOP proxy, exposing the message listener's interfaces as well as the endpoint SPI through an AOP introduction.

Parameters
xaResource:XAResource

Doc from jakarta.resource.spi.endpoint.MessageEndpointFactory.createEndpoint.

an optional XAResource instance used to get transaction notifications when the message delivery is transacted.

Returns:MessageEndpoint

Doc from jakarta.resource.spi.endpoint.MessageEndpointFactory.createEndpoint.

a message endpoint instance.

Annotations
@Override
Exceptions
UnavailableException:

Doc from jakarta.resource.spi.endpoint.MessageEndpointFactory.createEndpoint.

indicates a transient failure in creating a message endpoint. Subsequent attempts to create a message endpoint might succeed.

createEndpointInternalback to summary
protected AbstractMessageEndpointFactory.AbstractMessageEndpoint createEndpointInternal() throws UnavailableException

Implements abstract org.springframework.jca.endpoint.AbstractMessageEndpointFactory.createEndpointInternal.

Creates a concrete generic message endpoint, internal to this factory.

Returns:AbstractMessageEndpointFactory.AbstractMessageEndpoint

Doc from org.springframework.jca.endpoint.AbstractMessageEndpointFactory.createEndpointInternal.

the actual endpoint instance (never null)

Annotations
@Override
Exceptions
UnavailableException:

Doc from org.springframework.jca.endpoint.AbstractMessageEndpointFactory.createEndpointInternal.

if no endpoint is available at present

getMessageListenerback to summary
protected Object getMessageListener()

Return the message listener object for this endpoint.

Since
5.0
setMessageListenerback to summary
public void setMessageListener(Object messageListener)

Specify the message listener object that the endpoint should expose (e.g. a jakarta.jms.MessageListener objects or jakarta.resource.cci.MessageListener implementation).

org.springframework.jca.endpoint back to summary

private Class GenericMessageEndpointFactory.GenericMessageEndpoint

extends AbstractMessageEndpoint
implements MethodInterceptor
Class Inheritance
All Implemented Interfaces
org.aopalliance.intercept.MethodInterceptor, org.aopalliance.intercept.Interceptor, org.aopalliance.aop.Advice

Private inner class that implements the concrete generic message endpoint, as an AOP Alliance MethodInterceptor that will be invoked by a proxy.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private Exception
protected ClassLoader
getEndpointClassLoader()

Implements abstract org.springframework.jca.endpoint.AbstractMessageEndpointFactory.AbstractMessageEndpoint.getEndpointClassLoader.

Template method for exposing the endpoint's ClassLoader (typically the ClassLoader that the message listener class has been loaded with).

public Object
invoke(MethodInvocation
the method invocation joinpoint
methodInvocation
)

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

Implement this method to perform extra treatments before and after the invocation.

Inherited from org.springframework.jca.endpoint.AbstractMessageEndpointFactory.AbstractMessageEndpoint:
afterDeliverybeforeDeliveryhasBeforeDeliveryBeenCalledinitXAResourceonEndpointExceptionrelease

Constructor Detail

GenericMessageEndpointback to summary
private GenericMessageEndpoint()

Method Detail

adaptExceptionIfNecessaryback to summary
private Exception adaptExceptionIfNecessary(MethodInvocation methodInvocation, ResourceException ex)
getEndpointClassLoaderback to summary
protected ClassLoader getEndpointClassLoader()

Implements abstract org.springframework.jca.endpoint.AbstractMessageEndpointFactory.AbstractMessageEndpoint.getEndpointClassLoader.

Doc from org.springframework.jca.endpoint.AbstractMessageEndpointFactory.AbstractMessageEndpoint.getEndpointClassLoader.

Template method for exposing the endpoint's ClassLoader (typically the ClassLoader that the message listener class has been loaded with).

Returns:ClassLoader

the endpoint ClassLoader (never null)

Annotations
@Override
invokeback to summary
public Object invoke(MethodInvocation methodInvocation) throws Throwable

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

Doc from org.aopalliance.intercept.MethodInterceptor.invoke.

Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invoke Joinpoint#proceed().

Parameters
methodInvocation:MethodInvocation

the method invocation joinpoint

Returns:Object

the result of the call to Joinpoint#proceed(); might be intercepted by the interceptor

Annotations
@Override
@Nullable
Exceptions
Throwable:
if the interceptors or the target object throws an exception
org.springframework.jca.endpoint back to summary

public Class GenericMessageEndpointFactory.InternalResourceException

extends RuntimeException
Class Inheritance
Annotations
@SuppressWarnings:serial

Internal exception thrown when a ResourceException has been encountered during the endpoint invocation.

Will only be used if the ResourceAdapter does not invoke the endpoint's beforeDelivery and afterDelivery directly, leaving it up to the concrete endpoint to apply those - and to handle any ResourceExceptions thrown from them.

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

InternalResourceExceptionback to summary
public InternalResourceException(ResourceException cause)