Spring AMQP

org.springframework.amqp.rabbit.connection
Class RabbitAccessor

java.lang.Object
  extended by org.springframework.amqp.rabbit.connection.RabbitAccessor
All Implemented Interfaces:
InitializingBean
Direct Known Subclasses:
AbstractMessageListenerContainer, RabbitTemplate

public abstract class RabbitAccessor
extends Object
implements InitializingBean

Author:
Mark Fisher, Dave Syer

Field Summary
protected  org.apache.commons.logging.Log logger
          Logger available to subclasses
 
Constructor Summary
RabbitAccessor()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  RuntimeException convertRabbitAccessException(Exception ex)
           
protected  Connection createConnection()
          Create a RabbitMQ Connection via this template's ConnectionFactory and its host and port values.
protected  com.rabbitmq.client.Channel getChannel(RabbitResourceHolder holder)
          Fetch an appropriate Channel from the given RabbitResourceHolder.
protected  Connection getConnection(RabbitResourceHolder holder)
          Fetch an appropriate Connection from the given RabbitResourceHolder.
 ConnectionFactory getConnectionFactory()
          Return the ConnectionFactory that this accessor uses for obtaining RabbitMQ Connections.
protected  RabbitResourceHolder getTransactionalResourceHolder()
           
 boolean isChannelTransacted()
           
 void setChannelTransacted(boolean transactional)
          Flag to indicate that channels created by this component will be transactional.
 void setConnectionFactory(ConnectionFactory connectionFactory)
          Set the ConnectionFactory to use for obtaining RabbitMQ Connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Logger available to subclasses

Constructor Detail

RabbitAccessor

public RabbitAccessor()
Method Detail

isChannelTransacted

public boolean isChannelTransacted()

setChannelTransacted

public void setChannelTransacted(boolean transactional)
Flag to indicate that channels created by this component will be transactional.

Parameters:
transactional - the flag value to set

setConnectionFactory

public void setConnectionFactory(ConnectionFactory connectionFactory)
Set the ConnectionFactory to use for obtaining RabbitMQ Connections.


getConnectionFactory

public ConnectionFactory getConnectionFactory()
Return the ConnectionFactory that this accessor uses for obtaining RabbitMQ Connections.


afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface InitializingBean

createConnection

protected Connection createConnection()
                               throws IOException
Create a RabbitMQ Connection via this template's ConnectionFactory and its host and port values.

Returns:
the new RabbitMQ Connection
Throws:
IOException - if thrown by RabbitMQ API methods
See Also:
ConnectionFactory.createConnection()

getConnection

protected Connection getConnection(RabbitResourceHolder holder)
Fetch an appropriate Connection from the given RabbitResourceHolder.

Parameters:
holder - the RabbitResourceHolder
Returns:
an appropriate Connection fetched from the holder, or null if none found

getChannel

protected com.rabbitmq.client.Channel getChannel(RabbitResourceHolder holder)
Fetch an appropriate Channel from the given RabbitResourceHolder.

Parameters:
holder - the RabbitResourceHolder
Returns:
an appropriate Channel fetched from the holder, or null if none found

getTransactionalResourceHolder

protected RabbitResourceHolder getTransactionalResourceHolder()

convertRabbitAccessException

protected RuntimeException convertRabbitAccessException(Exception ex)

Spring AMQP

Copyright © 2011. All Rights Reserved.