Interface ConnectionFactoryUtils.ResourceFactory

  • Enclosing class:
    ConnectionFactoryUtils

    public static interface ConnectionFactoryUtils.ResourceFactory
    Callback interface for resource creation. Serving as argument for the doGetTransactionalChannel method.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      com.rabbitmq.client.Channel createChannel​(Connection con)
      Create a new RabbitMQ Session for registration with a RabbitResourceHolder.
      Connection createConnection()
      Create a new RabbitMQ Connection for registration with a RabbitResourceHolder.
      com.rabbitmq.client.Channel getChannel​(RabbitResourceHolder holder)
      Fetch an appropriate Channel from the given RabbitResourceHolder.
      Connection getConnection​(RabbitResourceHolder holder)
      Fetch an appropriate Connection from the given RabbitResourceHolder.
      boolean isSynchedLocalTransactionAllowed()
      Return whether to allow for a local RabbitMQ transaction that is synchronized with a Spring-managed transaction (where the main transaction might be a JDBC-based one for a specific DataSource, for example), with the RabbitMQ transaction committing right after the main transaction.
    • Method Detail

      • getChannel

        @Nullable
        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
      • getConnection

        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
      • createConnection

        Connection createConnection()
                             throws java.io.IOException
        Create a new RabbitMQ Connection for registration with a RabbitResourceHolder.
        Returns:
        the new RabbitMQ Connection
        Throws:
        java.io.IOException - if thrown by RabbitMQ API methods
      • createChannel

        com.rabbitmq.client.Channel createChannel​(Connection con)
                                           throws java.io.IOException
        Create a new RabbitMQ Session for registration with a RabbitResourceHolder.
        Parameters:
        con - the RabbitMQ Connection to create a Channel for
        Returns:
        the new RabbitMQ Channel
        Throws:
        java.io.IOException - if thrown by RabbitMQ API methods
      • isSynchedLocalTransactionAllowed

        boolean isSynchedLocalTransactionAllowed()
        Return whether to allow for a local RabbitMQ transaction that is synchronized with a Spring-managed transaction (where the main transaction might be a JDBC-based one for a specific DataSource, for example), with the RabbitMQ transaction committing right after the main transaction.
        Returns:
        whether to allow for synchronizing a local RabbitMQ transaction