Class JmsDestinationAccessor
- java.lang.Object
- org.springframework.jms.support.JmsAccessor
- org.springframework.jms.support.destination.JmsDestinationAccessor
- All Implemented Interfaces:
InitializingBean
- Direct Known Subclasses:
AbstractJmsListeningContainer
,JmsTemplate
public abstract class JmsDestinationAccessor extends JmsAccessor
Base class forJmsTemplate
and other JMS-accessing gateway helpers, adding destination-related properties toJmsAccessor's
common properties.Not intended to be used directly. See
JmsTemplate
.- Since:
- 1.2.5
- Author:
- Juergen Hoeller
- See Also:
JmsAccessor
,JmsTemplate
Field Summary
Fields Modifier and Type Field Description static long
RECEIVE_TIMEOUT_INDEFINITE_WAIT
Timeout value indicating a blocking receive without timeout.static long
RECEIVE_TIMEOUT_NO_WAIT
Timeout value indicating that a receive operation should check if a message is immediately available without blocking.Fields inherited from class org.springframework.jms.support.JmsAccessor
logger
Constructor Summary
Constructors Constructor Description JmsDestinationAccessor()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DestinationResolver
getDestinationResolver()
Return the DestinationResolver for this accessor (nevernull
).boolean
isPubSubDomain()
Return whether the Publish/Subscribe domain (Topics
) is used.protected Message
receiveFromConsumer(MessageConsumer consumer, long timeout)
Actually receive a message from the given consumer.protected Destination
resolveDestinationName(Session session, String destinationName)
Resolve the given destination name into a JMSDestination
, via this accessor'sDestinationResolver
.void
setDestinationResolver(DestinationResolver destinationResolver)
Set theDestinationResolver
that is to be used to resolveDestination
references for this accessor.void
setPubSubDomain(boolean pubSubDomain)
Configure the destination accessor with knowledge of the JMS domain used.Methods inherited from class org.springframework.jms.support.JmsAccessor
afterPropertiesSet, convertJmsAccessException, createConnection, createSession, getConnectionFactory, getSessionAcknowledgeMode, isClientAcknowledge, isSessionTransacted, obtainConnectionFactory, setConnectionFactory, setSessionAcknowledgeMode, setSessionAcknowledgeModeName, setSessionTransacted
Field Detail
RECEIVE_TIMEOUT_NO_WAIT
public static final long RECEIVE_TIMEOUT_NO_WAIT
Timeout value indicating that a receive operation should check if a message is immediately available without blocking.- Since:
- 4.3
- See Also:
- Constant Field Values
RECEIVE_TIMEOUT_INDEFINITE_WAIT
public static final long RECEIVE_TIMEOUT_INDEFINITE_WAIT
Timeout value indicating a blocking receive without timeout.- Since:
- 4.3
- See Also:
- Constant Field Values
Constructor Detail
JmsDestinationAccessor
public JmsDestinationAccessor()
Method Detail
setDestinationResolver
public void setDestinationResolver(DestinationResolver destinationResolver)
Set theDestinationResolver
that is to be used to resolveDestination
references for this accessor.The default resolver is a DynamicDestinationResolver. Specify a JndiDestinationResolver for resolving destination names as JNDI locations.
getDestinationResolver
public DestinationResolver getDestinationResolver()
Return the DestinationResolver for this accessor (nevernull
).
setPubSubDomain
public void setPubSubDomain(boolean pubSubDomain)
Configure the destination accessor with knowledge of the JMS domain used. Default is Point-to-Point (Queues).This setting primarily indicates what type of destination to resolve if dynamic destinations are enabled.
- Parameters:
pubSubDomain
- "true" for the Publish/Subscribe domain (Topics
), "false" for the Point-to-Point domain (Queues
)- See Also:
setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver)
isPubSubDomain
public boolean isPubSubDomain()
resolveDestinationName
protected Destination resolveDestinationName(Session session, String destinationName) throws JMSException
Resolve the given destination name into a JMSDestination
, via this accessor'sDestinationResolver
.- Parameters:
session
- the current JMSSession
destinationName
- the name of the destination- Returns:
- the located
Destination
- Throws:
JMSException
- if resolution failed- See Also:
setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver)
receiveFromConsumer
@Nullable protected Message receiveFromConsumer(MessageConsumer consumer, long timeout) throws JMSException
Actually receive a message from the given consumer.- Parameters:
consumer
- the JMS MessageConsumer to receive withtimeout
- the receive timeout (a negative value indicates a no-wait receive; 0 indicates an indefinite wait attempt)- Returns:
- the JMS Message received, or
null
if none - Throws:
JMSException
- if thrown by JMS API methods- Since:
- 4.3
- See Also:
RECEIVE_TIMEOUT_NO_WAIT
,RECEIVE_TIMEOUT_INDEFINITE_WAIT