use of org.apache.activemq.broker.region.policy.DeadLetterStrategy in project activemq-artemis by apache.
the class DeadLetterTestSupport method createBroker.
protected BrokerService createBroker() throws Exception {
BrokerService broker = new BrokerService();
broker.setPersistent(false);
PolicyEntry policy = new PolicyEntry();
DeadLetterStrategy defaultDeadLetterStrategy = policy.getDeadLetterStrategy();
if (defaultDeadLetterStrategy != null) {
defaultDeadLetterStrategy.setProcessNonPersistent(true);
}
PolicyMap pMap = new PolicyMap();
pMap.setDefaultEntry(policy);
broker.setDestinationPolicy(pMap);
return broker;
}
use of org.apache.activemq.broker.region.policy.DeadLetterStrategy in project activemq-artemis by apache.
the class DiscardingDeadLetterPolicyTest method createBroker.
@Override
protected BrokerService createBroker() throws Exception {
BrokerService broker = super.createBroker();
PolicyEntry policy = new PolicyEntry();
DeadLetterStrategy strategy = new DiscardingDeadLetterStrategy();
strategy.setProcessNonPersistent(true);
policy.setDeadLetterStrategy(strategy);
PolicyMap pMap = new PolicyMap();
pMap.setDefaultEntry(policy);
broker.setDestinationPolicy(pMap);
return broker;
}
use of org.apache.activemq.broker.region.policy.DeadLetterStrategy in project activemq-artemis by apache.
the class RequestReplyTempDestRemovalAdvisoryRaceTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
responseReceived.set(0);
respondentSendError.set(0);
forwardFailures.set(0);
sendsWithNoConsumers.set(0);
networkConnectors.clear();
advisoryConsumerConnections.clear();
consumerDemandExists = new CountDownLatch(1);
createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_A + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false);
createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_B + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false);
createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_C + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false);
PolicyMap map = new PolicyMap();
PolicyEntry defaultEntry = new PolicyEntry();
defaultEntry.setSendAdvisoryIfNoConsumers(true);
DeadLetterStrategy deadletterStrategy = new SharedDeadLetterStrategy();
deadletterStrategy.setProcessNonPersistent(true);
defaultEntry.setDeadLetterStrategy(deadletterStrategy);
defaultEntry.setDispatchPolicy(new PriorityDispatchPolicy());
map.put(new ActiveMQTempTopic(">"), defaultEntry);
for (BrokerItem item : brokers.values()) {
item.broker.setDestinationPolicy(map);
}
}
use of org.apache.activemq.broker.region.policy.DeadLetterStrategy in project activemq-artemis by apache.
the class IndividualDeadLetterTest method createBroker.
@Override
protected BrokerService createBroker() throws Exception {
BrokerService broker = super.createBroker();
PolicyEntry policy = new PolicyEntry();
DeadLetterStrategy strategy = new IndividualDeadLetterStrategy();
strategy.setProcessNonPersistent(true);
policy.setDeadLetterStrategy(strategy);
PolicyMap pMap = new PolicyMap();
pMap.setDefaultEntry(policy);
broker.setDestinationPolicy(pMap);
return broker;
}
use of org.apache.activemq.broker.region.policy.DeadLetterStrategy in project activemq-artemis by apache.
the class TimeStampingBrokerPluginTest method setUp.
@Override
@Before
public void setUp() throws Exception {
TimeStampingBrokerPlugin tsbp = new TimeStampingBrokerPlugin();
tsbp.setZeroExpirationOverride(expiry);
tsbp.setTtlCeiling(expiry);
broker = new BrokerService();
broker.setPersistent(false);
broker.setUseJmx(true);
broker.setPlugins(new BrokerPlugin[] { tsbp });
tcpConnector = broker.addConnector("tcp://localhost:0");
// Add policy and individual DLQ strategy
PolicyEntry policy = new PolicyEntry();
DeadLetterStrategy strategy = new IndividualDeadLetterStrategy();
strategy.setProcessExpired(true);
((IndividualDeadLetterStrategy) strategy).setUseQueueForQueueMessages(true);
((IndividualDeadLetterStrategy) strategy).setQueuePrefix("DLQ.");
strategy.setProcessNonPersistent(true);
policy.setDeadLetterStrategy(strategy);
PolicyMap pMap = new PolicyMap();
pMap.setDefaultEntry(policy);
broker.setDestinationPolicy(pMap);
broker.start();
// Create a ConnectionFactory
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(tcpConnector.getConnectUri());
// Create a Connection
connection = connectionFactory.createConnection();
connection.start();
// Create a Session
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Create the destination Queue
destination = session.createQueue(queue);
// Create a MessageProducer from the Session to the Topic or Queue
producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
}
Aggregations