Search in sources :

Example 1 with DurableTopicSubscription

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

the class DurableSubscriptionUnsubscribeTest method assertCount.

private void assertCount(int all, int active) throws Exception {
    int inactive = all - active;
    // broker check
    Destination destination = broker.getDestination(topic);
    List<Subscription> subs = destination.getConsumers();
    int cActive = 0, cInactive = 0;
    for (Subscription sub : subs) {
        if (sub instanceof DurableTopicSubscription) {
            DurableTopicSubscription durable = (DurableTopicSubscription) sub;
            if (durable.isActive())
                cActive++;
            else
                cInactive++;
        }
    }
    assertEquals(active, cActive);
    assertEquals(inactive, cInactive);
    // admin view
    ObjectName[] subscriptions = broker.getAdminView().getDurableTopicSubscribers();
    assertEquals(active, subscriptions.length);
    subscriptions = broker.getAdminView().getInactiveDurableTopicSubscribers();
    assertEquals(inactive, subscriptions.length);
    // check the strange false MBean
    if (all == 0)
        assertEquals(0, countMBean());
    // check if we got all advisories
    assertEquals(100, all + advisories.get());
}
Also used : Destination(org.apache.activemq.broker.region.Destination) DurableTopicSubscription(org.apache.activemq.broker.region.DurableTopicSubscription) Subscription(org.apache.activemq.broker.region.Subscription) DurableTopicSubscription(org.apache.activemq.broker.region.DurableTopicSubscription) ObjectName(javax.management.ObjectName)

Aggregations

ObjectName (javax.management.ObjectName)1 Destination (org.apache.activemq.broker.region.Destination)1 DurableTopicSubscription (org.apache.activemq.broker.region.DurableTopicSubscription)1 Subscription (org.apache.activemq.broker.region.Subscription)1