Andrea Tarocchi created ARTEMIS-1742:
----------------------------------------
Summary: possible problem with embedded broker and vm
acceptor/connector
Key: ARTEMIS-1742
URL: https://issues.apache.org/jira/browse/ARTEMIS-1742
Project: ActiveMQ Artemis
Issue Type: Bug
Components: Broker
Affects Versions: 2.3.0
Reporter: Andrea Tarocchi
Attachments: camel-jms.zip
In camel-jms component we keep having some random failing tests using embedded
artemis broker.
Basically the same tests are run using embedded artemis broker and embedded amq
broker and the same test is re ran up to 3 times if it has a failure (in that
case is marked as flaky), we keep experiencing flaky tests for artemis and not
for amq.
I've attached a simplified as possible reproducer which run the same test 50
times only using artemis embedded broker (is a pretty simple write and read
from a temp queue).
Running it a couple of times with: \{{mvn clean test}} should manifest the
flaky behaviour.
Might be we init/destroy the embedded broker in the wrong way?
{code:java}
public ConnectionFactory createConnectionFactory(final int
maximumRedeliveries, final boolean persistent) {
int id = BROKER_COUNT.incrementAndGet();
String baseDir = DATA_DIR + File.separator + id;
final Configuration configuration;
try {
configuration = new ConfigurationImpl()
.setPersistenceEnabled(persistent)
.setSecurityEnabled(false)
.setBindingsDirectory(baseDir + File.separator + "bindings")
.setJournalDirectory(baseDir + File.separator + "journal")
.setPagingDirectory(baseDir + File.separator + "paging")
.setLargeMessagesDirectory(baseDir + File.separator +
"largemessages")
.setCheckForLiveServer(false)
.setEnabledAsyncConnectionExecution(false)
.setManagementNotificationAddress( new
SimpleString("activemq.notifications") )
.setCheckForLiveServer(false)
.setClusterConfigurations( new ArrayList<>() )
.addAcceptorConfiguration("invm", "vm://" + id)
.addConnectorConfiguration("invm", "vm://" + id);
} catch (final Exception e) {
throw new ExceptionInInitializerError(e);
}
final ConnectionFactoryConfiguration cfConfig = new
ConnectionFactoryConfigurationImpl().setName("cf")
.setConnectorNames("invm").setBindings("cf");
final JMSConfiguration jmsConfig = new JMSConfigurationImpl()
.setConnectionFactoryConfigurations(singletonList(cfConfig));
EmbeddedJMS broker = new
EmbeddedJMS().setConfiguration(configuration).setJmsConfiguration(jmsConfig);
try {
broker.start();
} catch (final Exception e) {
throw new ExceptionInInitializerError(e);
}
final AddressSettings addressSettings = new AddressSettings()
.setMaxDeliveryAttempts(maximumRedeliveries)
.setDeadLetterAddress(new SimpleString("jms.queue.deadletter"))
.setExpiryAddress(new
SimpleString("jms.queue.expired"))
.setAutoCreateAddresses(true)
.setAutoCreateQueues(true);
broker.getActiveMQServer().getAddressSettingsRepository().addMatch("#",
addressSettings);
TransportConfiguration transportConfigs = new
TransportConfiguration(InVMConnectorFactory.class.getName());
transportConfigs.getParams().put(TransportConstants.SERVER_ID_PROP_NAME, id);
ServerLocator serviceLocator =
ActiveMQClient.createServerLocator(false, transportConfigs);
ActiveMQConnectionFactory acf = new
ActiveMQConnectionFactory(serviceLocator);
return acf;
}
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)