Search in sources :

Example 1 with IndividualDeadLetterStrategy

use of org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy 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;
}
Also used : IndividualDeadLetterStrategy(org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy) PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) IndividualDeadLetterStrategy(org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy) DeadLetterStrategy(org.apache.activemq.broker.region.policy.DeadLetterStrategy) BrokerService(org.apache.activemq.broker.BrokerService) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry)

Example 2 with IndividualDeadLetterStrategy

use of org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy in project activemq-artemis by apache.

the class PerDurableConsumerDeadLetterTest method createBroker.

@Override
protected BrokerService createBroker() throws Exception {
    BrokerService broker = super.createBroker();
    PolicyEntry policy = new PolicyEntry();
    IndividualDeadLetterStrategy strategy = new IndividualDeadLetterStrategy();
    strategy.setProcessNonPersistent(true);
    strategy.setDestinationPerDurableSubscriber(true);
    policy.setDeadLetterStrategy(strategy);
    PolicyMap pMap = new PolicyMap();
    pMap.setDefaultEntry(policy);
    broker.setDestinationPolicy(pMap);
    return broker;
}
Also used : IndividualDeadLetterStrategy(org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy) PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) BrokerService(org.apache.activemq.broker.BrokerService) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry)

Example 3 with IndividualDeadLetterStrategy

use of org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy 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);
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) IndividualDeadLetterStrategy(org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy) PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) IndividualDeadLetterStrategy(org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy) DeadLetterStrategy(org.apache.activemq.broker.region.policy.DeadLetterStrategy) BrokerService(org.apache.activemq.broker.BrokerService) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry) Before(org.junit.Before)

Aggregations

BrokerService (org.apache.activemq.broker.BrokerService)3 IndividualDeadLetterStrategy (org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy)3 PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)3 PolicyMap (org.apache.activemq.broker.region.policy.PolicyMap)3 DeadLetterStrategy (org.apache.activemq.broker.region.policy.DeadLetterStrategy)2 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 Before (org.junit.Before)1