public interface MatsTestBroker
mats.test.broker
" is set, it directs which type of broker
should be connected to, and possibly instantiate embedded.
If the system property "mats.test.brokerurl
" is set, it both defines whether the
embedded message broker will be created and which URL the created ConnectionFactory should use.Modifier and Type | Interface and Description |
---|---|
static class |
MatsTestBroker.MatsTestBroker_ActiveMq
Either creates an in-vm ActiveMQ, or an ActiveMQ ConnectionFactory to an external URL, based on system
properties.
|
static class |
MatsTestBroker.MatsTestBroker_Artemis
Creates a connection to an Artemis broker.
|
static class |
MatsTestBroker.MatsTestBroker_InVmActiveMq
Creates an in-vm ActiveMQ no matter what the properties says.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SYSPROP_MATS_TEST_BROKER
Which Broker client to use (which JMS
ConnectionFactory implementation): activemq (default), artemis or
rabbitmq - or if a class-name like String, assumes that it is an implementation of the present interface
(MatsTestBroker ) and instantiates that. |
static java.lang.String |
SYSPROP_MATS_TEST_BROKER_VALUE_ACTIVEMQ
DEFAULT: Use ActiveMQ as broker.
|
static java.lang.String |
SYSPROP_MATS_TEST_BROKER_VALUE_ARTEMIS
Use Artemis (Apache ActiveMQ Artemis) as broker - this was formerly JBoss HornetQ.
|
static java.lang.String |
SYSPROP_MATS_TEST_BROKER_VALUE_RABBITMQ
Use RabbitMQ as broker.
|
static java.lang.String |
SYSPROP_MATS_TEST_BROKERURL
System property ("-D" jvm argument) that if set to something else than
SYSPROP_MATS_TEST_BROKERURL_VALUE_IN_VM , will
Not start an embedded ("in-VM") ActiveMQ instance.
Make the ConnectionFactory use the property's value as brokerURL - with the special case that if the value is
"LOCALHOST ", it means default localhost connection string
for active broker , e.g. |
static java.lang.String |
SYSPROP_MATS_TEST_BROKERURL_VALUE_IN_VM
DEFAULT: If the value of
SYSPROP_MATS_TEST_BROKERURL is this value OR not set (i.e. |
static java.lang.String |
SYSPROP_MATS_TEST_BROKERURL_VALUE_LOCALHOST
If the value of
SYSPROP_MATS_TEST_BROKERURL is this value, it means default localhost connection string
for active broker , e.g. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Stops the created in-vm broker, if it was created (read
SYSPROP_MATS_TEST_BROKERURL ). |
static MatsTestBroker |
create() |
static MatsTestBroker |
createUniqueInVmActiveMq()
This is a special factory method, which creates a unique (randomly named) in-vm ActiveMQ instance, no matter what
the system properties says.
|
javax.jms.ConnectionFactory |
getConnectionFactory() |
static final java.lang.String SYSPROP_MATS_TEST_BROKER
ConnectionFactory
implementation): activemq (default), artemis or
rabbitmq - or if a class-name like String, assumes that it is an implementation of the present interface
(MatsTestBroker
) and instantiates that.static final java.lang.String SYSPROP_MATS_TEST_BROKER_VALUE_ACTIVEMQ
static final java.lang.String SYSPROP_MATS_TEST_BROKER_VALUE_ARTEMIS
static final java.lang.String SYSPROP_MATS_TEST_BROKER_VALUE_RABBITMQ
static final java.lang.String SYSPROP_MATS_TEST_BROKERURL
SYSPROP_MATS_TEST_BROKERURL_VALUE_IN_VM
, will
LOCALHOST
", it means default localhost connection string
for active broker
, e.g. for ActiveMQ: "tcp://localhost:61616"
Value is "mats.test.brokerurl"
static final java.lang.String SYSPROP_MATS_TEST_BROKERURL_VALUE_IN_VM
SYSPROP_MATS_TEST_BROKERURL
is this value OR not set (i.e. this is the
default), the ConnectionFactory will use an in-VM connection method for the active broker
, e.g. for ActiveMQ: "vm://{brokername}"
. (Note that RabbitMQ does not support in-VM,
since it's written in Erlang).
Value is "in-vm"
static final java.lang.String SYSPROP_MATS_TEST_BROKERURL_VALUE_LOCALHOST
SYSPROP_MATS_TEST_BROKERURL
is this value, it means default localhost connection string
for active broker
, e.g. for ActiveMQ: "tcp://localhost:61616"
.
Value is "localhost"
static MatsTestBroker create()
static MatsTestBroker createUniqueInVmActiveMq()
javax.jms.ConnectionFactory getConnectionFactory()
void close()
SYSPROP_MATS_TEST_BROKERURL
). Called "close()"
to hook into the default Spring lifecycle if it is instantiated as a Spring Bean.