public class SpringJmsMatsFactoryWrapper extends MatsFactory.MatsFactoryWrapper implements MatsInterceptable
MatsFactory
,
it also needs the JMS ConnectionFactory
which the MatsFactory employs as that will be used to handle the
properties of "MatsTestBrokerInterface" for when the MatsFactory produced will be used in a test scenario (which it
will in a setup employing the ScenarioConnectionFactoryProducer
).
Current features:
ScenarioConnectionFactoryWrapper
and the scenario is
MatsScenario.LOCALVM
), it sets the MatsFactory's default concurrency to 2, to avoid tons of unnecessary
threads and polluted log output.postConstructForFactoryBean(Environment, ApplicationContext)
method!MatsInterceptable.MatsLoggingInterceptor, MatsInterceptable.MatsMetricsInterceptor
MatsFactory.ContextLocal, MatsFactory.FactoryConfig, MatsFactory.MatsFactoryWrapper, MatsFactory.MatsWrapper<T>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LATE_POPULATE_METHOD_NAME |
static java.lang.String |
MATS_TEST_BROKER_INTERFACE_CLASSNAME |
NO_CONFIG
Constructor and Description |
---|
SpringJmsMatsFactoryWrapper(javax.jms.ConnectionFactory connectionFactory,
MatsFactory matsFactory)
Note: The MatsFactory provided may be a
MatsFactory.MatsFactoryWrapper , but it must resolve to a
JmsMatsFactory via the MatsFactory.unwrapFully() . |
Modifier and Type | Method and Description |
---|---|
void |
addInitiationInterceptor(MatsInitiateInterceptor initiateInterceptor) |
void |
addStageInterceptor(MatsStageInterceptor stageInterceptor) |
<T extends MatsInitiateInterceptor> |
getInitiationInterceptor(java.lang.Class<T> interceptorClass) |
java.util.List<MatsInitiateInterceptor> |
getInitiationInterceptors() |
<T extends MatsStageInterceptor> |
getStageInterceptor(java.lang.Class<T> interceptorClass) |
java.util.List<MatsStageInterceptor> |
getStageInterceptors() |
protected void |
handleMatsFactoryConcurrencyForTestAndDevelopment(boolean matsTestPofileActive) |
protected void |
handleMatsTestBrokerInterfacePopulation(boolean matsTestProfileActive) |
void |
postConstruct()
If created as a @Bean, thus sitting directly in the Spring context, this class relies on Spring property
injection and
@PostConstruct being run. |
void |
postConstructForFactoryBean(org.springframework.core.env.Environment environment,
org.springframework.context.ApplicationContext applicationContext)
If you construct this bean using a Spring
FactoryBean (e.g. |
void |
removeInitiationInterceptor(MatsInitiateInterceptor initiateInterceptor) |
void |
removeStageInterceptor(MatsStageInterceptor stageInterceptor) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setEnvironment(org.springframework.core.env.Environment environment) |
equals, getDefaultInitiator, getEndpoint, getEndpoints, getFactoryConfig, getInitiators, getOrCreateInitiator, hashCode, holdEndpointsUntilFactoryIsStarted, setWrappee, single, single, staged, staged, start, stop, subscriptionTerminator, subscriptionTerminator, terminator, terminator, toString, unwrap, unwrapFully, unwrapTo, waitForReceiving
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
close
public static final java.lang.String MATS_TEST_BROKER_INTERFACE_CLASSNAME
public static final java.lang.String LATE_POPULATE_METHOD_NAME
public SpringJmsMatsFactoryWrapper(javax.jms.ConnectionFactory connectionFactory, MatsFactory matsFactory)
MatsFactory.MatsFactoryWrapper
, but it must resolve to a
JmsMatsFactory
via the MatsFactory.unwrapFully()
.@Autowired public void setEnvironment(org.springframework.core.env.Environment environment)
@Autowired public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
@PostConstruct public void postConstruct()
@PostConstruct
being run. If you need to create this bean using a FactoryMethod
(e.g. because you have made a cool Mats single-annotation-configuration solution for your multiple
codebases), you must handle the lifecycle yourself - employ
postConstructForFactoryBean(Environment, ApplicationContext)
.public void postConstructForFactoryBean(org.springframework.core.env.Environment environment, org.springframework.context.ApplicationContext applicationContext)
FactoryBean
(e.g. because you have made a cool Mats
single-annotation-configuration solution for your multiple codebases), then you are responsible for its
lifecycle, and hence cannot rely on property setting and @PostConstruct
being run. Invoke this
method in your getObject()
(raw FactoryBean implementation) or createInstance()
(AbstractFactoryBean implementation). To get hold of the Spring Environment
and Spring
ApplicationContext
in the FactoryBean, simply use Spring injection on the FactoryBean, e.g. field-inject.environment
- the Spring Environment
applicationContext
- the Spring ApplicationContext
.postConstruct()
protected void handleMatsTestBrokerInterfacePopulation(boolean matsTestProfileActive)
protected void handleMatsFactoryConcurrencyForTestAndDevelopment(boolean matsTestPofileActive)
public void addInitiationInterceptor(MatsInitiateInterceptor initiateInterceptor)
addInitiationInterceptor
in interface MatsInterceptable
public java.util.List<MatsInitiateInterceptor> getInitiationInterceptors()
getInitiationInterceptors
in interface MatsInterceptable
public <T extends MatsInitiateInterceptor> java.util.Optional<T> getInitiationInterceptor(java.lang.Class<T> interceptorClass)
getInitiationInterceptor
in interface MatsInterceptable
public void removeInitiationInterceptor(MatsInitiateInterceptor initiateInterceptor)
removeInitiationInterceptor
in interface MatsInterceptable
public void addStageInterceptor(MatsStageInterceptor stageInterceptor)
addStageInterceptor
in interface MatsInterceptable
public java.util.List<MatsStageInterceptor> getStageInterceptors()
getStageInterceptors
in interface MatsInterceptable
public <T extends MatsStageInterceptor> java.util.Optional<T> getStageInterceptor(java.lang.Class<T> interceptorClass)
getStageInterceptor
in interface MatsInterceptable
public void removeStageInterceptor(MatsStageInterceptor stageInterceptor)
removeStageInterceptor
in interface MatsInterceptable