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);
  }
Пример #2
0
 /**
  * @param topic
  * @param clientId
  * @param subscriberName
  */
 public TopicStorePrefetch(
     Subscription subscription, Topic topic, String clientId, String subscriberName) {
   super(topic);
   this.subscription = subscription;
   this.store = (TopicMessageStore) topic.getMessageStore();
   this.clientId = clientId;
   this.subscriberName = subscriberName;
   this.maxProducersToAudit = 32;
   this.maxAuditDepth = 10000;
   resetSize();
   this.storeHasMessages = this.size > 0;
 }