Class ScenarioConnectionFactoryWrapper

  • All Implemented Interfaces:
    io.mats3.MatsFactory.MatsWrapper<javax.jms.ConnectionFactory>, javax.jms.ConnectionFactory, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.EnvironmentAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

    public class ScenarioConnectionFactoryWrapper
    extends io.mats3.util.wrappers.ConnectionFactoryWrapper
    implements org.springframework.context.EnvironmentAware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.SmartLifecycle
    A ConnectionFactoryWrapper which lazily decides which of the three MatsScenarios are active, and produces the wrapper-target ConnectionFactory based on that - you most probably want to use ScenarioConnectionFactoryProducer to make an instance of this class, but you can configure it directly too.

    The main documentation for this MatsScenario concept is in the JavaDoc of ScenarioConnectionFactoryProducer.

    See Also:
    ScenarioConnectionFactoryProducer, MatsProfiles, MatsScenario
    • Method Detail

      • setBeanName

        public void setBeanName​(java.lang.String name)
        Specified by:
        setBeanName in interface org.springframework.beans.factory.BeanNameAware
      • setEnvironment

        public void setEnvironment​(org.springframework.core.env.Environment environment)
        Specified by:
        setEnvironment in interface org.springframework.context.EnvironmentAware
      • setWrappee

        public void setWrappee​(javax.jms.ConnectionFactory targetConnectionFactory)
        Specified by:
        setWrappee in interface io.mats3.MatsFactory.MatsWrapper<javax.jms.ConnectionFactory>
        Overrides:
        setWrappee in class io.mats3.util.wrappers.ConnectionFactoryWrapper
      • unwrap

        public javax.jms.ConnectionFactory unwrap()
        Specified by:
        unwrap in interface io.mats3.MatsFactory.MatsWrapper<javax.jms.ConnectionFactory>
        Overrides:
        unwrap in class io.mats3.util.wrappers.ConnectionFactoryWrapper
      • getMatsScenarioUsedToMakeConnectionFactory

        public MatsScenario getMatsScenarioUsedToMakeConnectionFactory()
        Returns:
        the MatsScenario that was used to make the ConnectionFactory returned by unwrap().
      • createTargetConnectionFactoryBasedOnScenarioDecider

        protected void createTargetConnectionFactoryBasedOnScenarioDecider()
      • getPhase

        public int getPhase()
        Specified by:
        getPhase in interface org.springframework.context.Phased
        Specified by:
        getPhase in interface org.springframework.context.SmartLifecycle
      • isAutoStartup

        public boolean isAutoStartup()
        Specified by:
        isAutoStartup in interface org.springframework.context.SmartLifecycle
      • start

        public void start()
        Specified by:
        start in interface org.springframework.context.Lifecycle
      • isRunning

        public boolean isRunning()
        Specified by:
        isRunning in interface org.springframework.context.Lifecycle
      • stop

        public void stop()
        Specified by:
        stop in interface org.springframework.context.Lifecycle
      • stop

        public void stop​(java.lang.Runnable callback)
        Specified by:
        stop in interface org.springframework.context.SmartLifecycle