类 JmsAccessor
- java.lang.Object
- org.springframework.jms.support.JmsAccessor
- 所有已实现的接口:
InitializingBean
- 直接已知子类:
JmsDestinationAccessor
public abstract class JmsAccessor extends Object implements InitializingBean
Base class forJmsTemplateand other JMS-accessing gateway helpers, defining common properties such as the JMSConnectionFactoryto operate on. The subclassJmsDestinationAccessoradds further, destination-related properties.Not intended to be used directly. See
JmsTemplate.- 从以下版本开始:
- 1.2
- 作者:
- Juergen Hoeller
- 另请参阅:
JmsDestinationAccessor,JmsTemplate
构造器概要
构造器 构造器 说明 JmsAccessor()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidafterPropertiesSet()Invoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.protected JmsExceptionconvertJmsAccessException(JMSException ex)Convert the specified checkedJMSExceptionto a Spring runtimeJmsExceptionequivalent.protected ConnectioncreateConnection()Create a JMS Connection via this template's ConnectionFactory.protected SessioncreateSession(Connection con)Create a JMS Session for the given Connection.ConnectionFactorygetConnectionFactory()Return the ConnectionFactory that this accessor uses for obtaining JMSConnections.intgetSessionAcknowledgeMode()Return the acknowledgement mode for JMSsessions.protected booleanisClientAcknowledge(Session session)Determine whether the given Session is in client acknowledge mode.booleanisSessionTransacted()Return whether the JMSsessionsused by this accessor are supposed to be transacted.voidsetConnectionFactory(ConnectionFactory connectionFactory)Set the ConnectionFactory to use for obtaining JMSConnections.voidsetSessionAcknowledgeMode(int sessionAcknowledgeMode)Set the JMS acknowledgement mode that is used when creating a JMSSessionto send a message.voidsetSessionAcknowledgeModeName(String constantName)Set the JMS acknowledgement mode by the name of the corresponding constant in the JMSSessioninterface, e.g.voidsetSessionTransacted(boolean sessionTransacted)Set the transaction mode that is used when creating a JMSSession.
构造器详细资料
JmsAccessor
public JmsAccessor()
方法详细资料
setConnectionFactory
public void setConnectionFactory(ConnectionFactory connectionFactory)
Set the ConnectionFactory to use for obtaining JMSConnections.
getConnectionFactory
public ConnectionFactory getConnectionFactory()
Return the ConnectionFactory that this accessor uses for obtaining JMSConnections.
setSessionTransacted
public void setSessionTransacted(boolean sessionTransacted)
Set the transaction mode that is used when creating a JMSSession. Default is "false".Note that within a JTA transaction, the parameters passed to
create(Queue/Topic)Session(boolean transacted, int acknowledgeMode)method are not taken into account. Depending on the Java EE transaction context, the container makes its own decisions on these values. Analogously, these parameters are not taken into account within a locally managed transaction either, since the accessor operates on an existing JMS Session in this case.Setting this flag to "true" will use a short local JMS transaction when running outside of a managed transaction, and a synchronized local JMS transaction in case of a managed transaction (other than an XA transaction) being present. This has the effect of a local JMS transaction being managed alongside the main transaction (which might be a native JDBC transaction), with the JMS transaction committing right after the main transaction.
isSessionTransacted
public boolean isSessionTransacted()
Return whether the JMSsessionsused by this accessor are supposed to be transacted.
setSessionAcknowledgeModeName
public void setSessionAcknowledgeModeName(String constantName)
Set the JMS acknowledgement mode by the name of the corresponding constant in the JMSSessioninterface, e.g. "CLIENT_ACKNOWLEDGE".If you want to use vendor-specific extensions to the acknowledgment mode, use
setSessionAcknowledgeMode(int)instead.- 参数:
constantName- the name of theSessionacknowledge mode constant- 另请参阅:
Session.AUTO_ACKNOWLEDGE,Session.CLIENT_ACKNOWLEDGE,Session.DUPS_OK_ACKNOWLEDGE,Connection.createSession(boolean, int)
setSessionAcknowledgeMode
public void setSessionAcknowledgeMode(int sessionAcknowledgeMode)
Set the JMS acknowledgement mode that is used when creating a JMSSessionto send a message.Default is
Session.AUTO_ACKNOWLEDGE.Vendor-specific extensions to the acknowledgment mode can be set here as well.
Note that inside an EJB, the parameters to the
create(Queue/Topic)Session(boolean transacted, int acknowledgeMode)method are not taken into account. Depending on the transaction context in the EJB, the container makes its own decisions on these values. See section 17.3.5 of the EJB spec.- 参数:
sessionAcknowledgeMode- the acknowledgement mode constant- 另请参阅:
Session.AUTO_ACKNOWLEDGE,Session.CLIENT_ACKNOWLEDGE,Session.DUPS_OK_ACKNOWLEDGE,Connection.createSession(boolean, int)
getSessionAcknowledgeMode
public int getSessionAcknowledgeMode()
Return the acknowledgement mode for JMSsessions.
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- 指定者:
afterPropertiesSet在接口中InitializingBean
convertJmsAccessException
protected JmsException convertJmsAccessException(JMSException ex)
Convert the specified checkedJMSExceptionto a Spring runtimeJmsExceptionequivalent.The default implementation delegates to the
JmsUtils.convertJmsAccessException(javax.jms.JMSException)method.- 参数:
ex- the original checkedJMSExceptionto convert- 返回:
- the Spring runtime
JmsExceptionwrappingex - 另请参阅:
JmsUtils.convertJmsAccessException(javax.jms.JMSException)
createConnection
protected Connection createConnection() throws JMSException
Create a JMS Connection via this template's ConnectionFactory.This implementation uses JMS 1.1 API.
- 返回:
- the new JMS Connection
- 抛出:
JMSException- if thrown by JMS API methods- 另请参阅:
ConnectionFactory.createConnection()
createSession
protected Session createSession(Connection con) throws JMSException
Create a JMS Session for the given Connection.This implementation uses JMS 1.1 API.
- 参数:
con- the JMS Connection to create a Session for- 返回:
- the new JMS Session
- 抛出:
JMSException- if thrown by JMS API methods- 另请参阅:
Connection.createSession(boolean, int)
isClientAcknowledge
protected boolean isClientAcknowledge(Session session) throws JMSException
Determine whether the given Session is in client acknowledge mode.This implementation uses JMS 1.1 API.
- 参数:
session- the JMS Session to check- 返回:
- whether the given Session is in client acknowledge mode
- 抛出:
JMSException- if thrown by JMS API methods- 另请参阅:
Session.getAcknowledgeMode(),Session.CLIENT_ACKNOWLEDGE