Search in sources :

Example 1 with RetainedMessageSubscriptionRecoveryPolicy

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

the class XBeanConfigTest method testBrokerConfiguredCorrectly.

public void testBrokerConfiguredCorrectly() throws Exception {
    // Validate the system properties are being evaluated in xbean.
    assertEquals("testbroker", brokerService.getBrokerName());
    Topic topic = (Topic) broker.addDestination(context, new ActiveMQTopic("FOO.BAR"), true);
    DispatchPolicy dispatchPolicy = topic.getDispatchPolicy();
    assertTrue("dispatchPolicy should be RoundRobinDispatchPolicy: " + dispatchPolicy, dispatchPolicy instanceof RoundRobinDispatchPolicy);
    SubscriptionRecoveryPolicy subscriptionRecoveryPolicy = topic.getSubscriptionRecoveryPolicy();
    subscriptionRecoveryPolicy = ((RetainedMessageSubscriptionRecoveryPolicy) subscriptionRecoveryPolicy).getWrapped();
    assertTrue("subscriptionRecoveryPolicy should be LastImageSubscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy, subscriptionRecoveryPolicy instanceof LastImageSubscriptionRecoveryPolicy);
    LOG.info("destination: " + topic);
    LOG.info("dispatchPolicy: " + dispatchPolicy);
    LOG.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy);
    topic = (Topic) broker.addDestination(context, new ActiveMQTopic("ORDERS.BOOKS"), true);
    dispatchPolicy = topic.getDispatchPolicy();
    assertTrue("dispatchPolicy should be StrictOrderDispatchPolicy: " + dispatchPolicy, dispatchPolicy instanceof StrictOrderDispatchPolicy);
    subscriptionRecoveryPolicy = topic.getSubscriptionRecoveryPolicy();
    subscriptionRecoveryPolicy = ((RetainedMessageSubscriptionRecoveryPolicy) subscriptionRecoveryPolicy).getWrapped();
    assertTrue("subscriptionRecoveryPolicy should be TimedSubscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy, subscriptionRecoveryPolicy instanceof TimedSubscriptionRecoveryPolicy);
    TimedSubscriptionRecoveryPolicy timedSubscriptionPolicy = (TimedSubscriptionRecoveryPolicy) subscriptionRecoveryPolicy;
    assertEquals("getRecoverDuration()", 60000, timedSubscriptionPolicy.getRecoverDuration());
    LOG.info("destination: " + topic);
    LOG.info("dispatchPolicy: " + dispatchPolicy);
    LOG.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy);
}
Also used : TimedSubscriptionRecoveryPolicy(org.apache.activemq.broker.region.policy.TimedSubscriptionRecoveryPolicy) RetainedMessageSubscriptionRecoveryPolicy(org.apache.activemq.broker.region.policy.RetainedMessageSubscriptionRecoveryPolicy) SubscriptionRecoveryPolicy(org.apache.activemq.broker.region.policy.SubscriptionRecoveryPolicy) LastImageSubscriptionRecoveryPolicy(org.apache.activemq.broker.region.policy.LastImageSubscriptionRecoveryPolicy) ActiveMQTopic(org.apache.activemq.command.ActiveMQTopic) TimedSubscriptionRecoveryPolicy(org.apache.activemq.broker.region.policy.TimedSubscriptionRecoveryPolicy) RoundRobinDispatchPolicy(org.apache.activemq.broker.region.policy.RoundRobinDispatchPolicy) LastImageSubscriptionRecoveryPolicy(org.apache.activemq.broker.region.policy.LastImageSubscriptionRecoveryPolicy) StrictOrderDispatchPolicy(org.apache.activemq.broker.region.policy.StrictOrderDispatchPolicy) DispatchPolicy(org.apache.activemq.broker.region.policy.DispatchPolicy) RoundRobinDispatchPolicy(org.apache.activemq.broker.region.policy.RoundRobinDispatchPolicy) StrictOrderDispatchPolicy(org.apache.activemq.broker.region.policy.StrictOrderDispatchPolicy) Topic(org.apache.activemq.broker.region.Topic) ActiveMQTopic(org.apache.activemq.command.ActiveMQTopic)

Aggregations

Topic (org.apache.activemq.broker.region.Topic)1 DispatchPolicy (org.apache.activemq.broker.region.policy.DispatchPolicy)1 LastImageSubscriptionRecoveryPolicy (org.apache.activemq.broker.region.policy.LastImageSubscriptionRecoveryPolicy)1 RetainedMessageSubscriptionRecoveryPolicy (org.apache.activemq.broker.region.policy.RetainedMessageSubscriptionRecoveryPolicy)1 RoundRobinDispatchPolicy (org.apache.activemq.broker.region.policy.RoundRobinDispatchPolicy)1 StrictOrderDispatchPolicy (org.apache.activemq.broker.region.policy.StrictOrderDispatchPolicy)1 SubscriptionRecoveryPolicy (org.apache.activemq.broker.region.policy.SubscriptionRecoveryPolicy)1 TimedSubscriptionRecoveryPolicy (org.apache.activemq.broker.region.policy.TimedSubscriptionRecoveryPolicy)1 ActiveMQTopic (org.apache.activemq.command.ActiveMQTopic)1