类 JndiDestinationResolver
- java.lang.Object
- org.springframework.jndi.JndiAccessor
- org.springframework.jndi.JndiLocatorSupport
- org.springframework.jms.support.destination.JndiDestinationResolver
public class JndiDestinationResolver extends JndiLocatorSupport implements CachingDestinationResolver
DestinationResolver
implementation which interprets destination names as JNDI locations (with a configurable fallback strategy).Allows for customizing the JNDI environment if necessary, for example specifying appropriate JNDI environment properties.
Dynamic queues and topics get cached by destination name. As a consequence, you need to use unique destination names across both queues and topics. Caching can be turned off through the
"cache"
flag.Note that the fallback to resolution of dynamic destinations is turned off by default. Switch the
"fallbackToDynamicDestination"
flag on to enable this functionality.- 从以下版本开始:
- 1.1
- 作者:
- Mark Pollack, Juergen Hoeller
- 另请参阅:
JndiAccessor.setJndiTemplate(org.springframework.jndi.JndiTemplate)
,JndiAccessor.setJndiEnvironment(java.util.Properties)
,setCache(boolean)
,setFallbackToDynamicDestination(boolean)
字段概要
从类继承的字段 org.springframework.jndi.JndiLocatorSupport
CONTAINER_PREFIX
从类继承的字段 org.springframework.jndi.JndiAccessor
logger
构造器概要
构造器 构造器 说明 JndiDestinationResolver()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
clearCache()
Clear the entire destination cache.void
removeFromCache(String destinationName)
Remove the destination with the given name from the cache (if cached by this resolver in the first place).Destination
resolveDestinationName(Session session, String destinationName, boolean pubSubDomain)
Resolve the given destination name, either as located resource or as dynamic destination.void
setCache(boolean cache)
Set whether to cache resolved destinations.void
setDynamicDestinationResolver(DestinationResolver dynamicDestinationResolver)
Set theDestinationResolver
to use when falling back to dynamic destinations.void
setFallbackToDynamicDestination(boolean fallbackToDynamicDestination)
Set whether this resolver is supposed to create dynamic destinations if the destination name is not found in JNDI.protected void
validateDestination(Destination destination, String destinationName, boolean pubSubDomain)
Validate the given Destination object, checking whether it matches the expected type.从类继承的方法 org.springframework.jndi.JndiLocatorSupport
convertJndiName, isResourceRef, lookup, lookup, setResourceRef
从类继承的方法 org.springframework.jndi.JndiAccessor
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
构造器详细资料
JndiDestinationResolver
public JndiDestinationResolver()
方法详细资料
setCache
public void setCache(boolean cache)
Set whether to cache resolved destinations. Default is "true".This flag can be turned off to re-lookup a destination for each operation, which allows for hot restarting of destinations. This is mainly useful during development.
Note that dynamic queues and topics get cached by destination name. As a consequence, you need to use unique destination names across both queues and topics.
setFallbackToDynamicDestination
public void setFallbackToDynamicDestination(boolean fallbackToDynamicDestination)
Set whether this resolver is supposed to create dynamic destinations if the destination name is not found in JNDI. Default is "false".Turn this flag on to enable transparent fallback to dynamic destinations.
setDynamicDestinationResolver
public void setDynamicDestinationResolver(DestinationResolver dynamicDestinationResolver)
Set theDestinationResolver
to use when falling back to dynamic destinations.The default is Spring's standard
DynamicDestinationResolver
.
resolveDestinationName
public Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain) throws JMSException
从接口复制的说明:DestinationResolver
Resolve the given destination name, either as located resource or as dynamic destination.- 指定者:
resolveDestinationName
在接口中DestinationResolver
- 参数:
session
- the current JMS Session (may benull
if the resolver implementation is able to work without it)destinationName
- the name of the destinationpubSubDomain
-true
if the domain is pub-sub,false
if P2P- 返回:
- the JMS destination (either a topic or a queue)
- 抛出:
JMSException
- if the JMS Session failed to resolve the destination
validateDestination
protected void validateDestination(Destination destination, String destinationName, boolean pubSubDomain)
Validate the given Destination object, checking whether it matches the expected type.- 参数:
destination
- the Destination object to validatedestinationName
- the name of the destinationpubSubDomain
-true
if a Topic is expected,false
in case of a Queue
removeFromCache
public void removeFromCache(String destinationName)
从接口复制的说明:CachingDestinationResolver
Remove the destination with the given name from the cache (if cached by this resolver in the first place).To be called if access to the specified destination failed, assuming that the JMS Destination object might have become invalid.
- 指定者:
removeFromCache
在接口中CachingDestinationResolver
- 参数:
destinationName
- the name of the destination
clearCache
public void clearCache()
从接口复制的说明:CachingDestinationResolver
Clear the entire destination cache.To be called in case of general JMS provider failure.
- 指定者:
clearCache
在接口中CachingDestinationResolver