Package org.apache.activemq.broker.region

Examples of org.apache.activemq.broker.region.RegionBroker


              
        assertTrue(ab.getAdvisoryDestinations().size() == 0);
        assertTrue(ab.getAdvisoryConsumers().size() == 0);
        assertTrue(ab.getAdvisoryProducers().size() == 0);
              
        RegionBroker rb = (RegionBroker) broker.getBroker().getAdaptor(
                RegionBroker.class);
        //there should be 2 destinations - advisories -
        //1 for the connection + 1 generic ones
        assertTrue(rb.getDestinationMap().size()==2);           
    }
View Full Code Here


        AdvisoryBroker ab = (AdvisoryBroker) broker.getBroker().getAdaptor(
                AdvisoryBroker.class);
        assertTrue(ab.getAdvisoryDestinations().size() == 0);
        assertTrue(ab.getAdvisoryConsumers().size() == 0);
        assertTrue(ab.getAdvisoryProducers().size() == 0);
        RegionBroker rb = (RegionBroker) broker.getBroker().getAdaptor(
                RegionBroker.class);
        //there should be 2 destinations - advisories -
        //1 for the connection + 1 generic ones
        assertTrue(rb.getDestinationMap().size()==2);       
       
    }
View Full Code Here

        AdvisoryBroker ab = (AdvisoryBroker) slave.getBroker().getAdaptor(
                AdvisoryBroker.class);
       
        assertEquals("the temp queues should not be visible as they are removed", 1, ab.getAdvisoryDestinations().size());
                      
        RegionBroker rb = (RegionBroker) slave.getBroker().getAdaptor(
                RegionBroker.class);
              
        //serverDestination +
        assertEquals(6, rb.getDestinationMap().size());    
       
        RegionBroker masterRb = (RegionBroker) broker.getBroker().getAdaptor(
                RegionBroker.class);

        LOG.info("enqueues " + rb.getDestinationStatistics().getEnqueues().getCount());
        assertEquals("enqueues match", rb.getDestinationStatistics().getEnqueues().getCount(), masterRb.getDestinationStatistics().getEnqueues().getCount());
       
        LOG.info("dequeues " + rb.getDestinationStatistics().getDequeues().getCount());
        assertEquals("dequeues match",
                rb.getDestinationStatistics().getDequeues().getCount(),
                masterRb.getDestinationStatistics().getDequeues().getCount());

        LOG.info("inflight, slave " + rb.getDestinationStatistics().getInflight().getCount()
                + ", master " + masterRb.getDestinationStatistics().getInflight().getCount());

        // not totally deterministic for this test - maybe due to async send
        //assertEquals("inflight match", rb.getDestinationStatistics().getInflight().getCount(), masterRb.getDestinationStatistics().getInflight().getCount());

        // slave does not actually dispatch any messages, so no request/reply(2) pair per iteration(COUNT)
        // slave estimate must be >= actual master value
        // master does not always reach expected total, should be assertEquals.., why?
        assertTrue("dispatched to slave is as good as master, master="
                + masterRb.getDestinationStatistics().getDispatched().getCount(),
                rb.getDestinationStatistics().getDispatched().getCount() + 2*messagesToSend >=
                masterRb.getDestinationStatistics().getDispatched().getCount());
    }
View Full Code Here

            Message msg = clientSession.createMessage();
            producer.send(msg);
        }
        Thread.sleep(5000);
       
        RegionBroker slaveRb = (RegionBroker) slave.getBroker().getAdaptor(
                RegionBroker.class);
        RegionBroker masterRb = (RegionBroker) broker.getBroker().getAdaptor(
                RegionBroker.class);
       
        assertEquals("inflight match expected", messageCount, masterRb.getDestinationStatistics().getInflight().getCount());       
        assertEquals("inflight match on slave and master", slaveRb.getDestinationStatistics().getInflight().getCount(), masterRb.getDestinationStatistics().getInflight().getCount());
       
        latch.countDown();
        Thread.sleep(5000);
        assertEquals("inflight match expected", 0, masterRb.getDestinationStatistics().getInflight().getCount());       
        assertEquals("inflight match on slave and master", slaveRb.getDestinationStatistics().getInflight().getCount(), masterRb.getDestinationStatistics().getInflight().getCount());
    }
View Full Code Here

            connection = createConnection();
        }
        connection.start();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        TemporaryQueue tempQueue = session.createTemporaryQueue();
        RegionBroker rb = (RegionBroker) broker.getBroker().getAdaptor(
                RegionBroker.class);
        assertTrue(rb.getDestinationMap().size()==4);
        tempQueue.delete();
        assertTrue(rb.getDestinationMap().size()==3);       
    }
View Full Code Here

        return result;
    }

    private static Map<ActiveMQDestination, org.apache.activemq.broker.region.Destination> getDestinationMap(BrokerService target,
            ActiveMQDestination destination) {
        RegionBroker regionBroker = (RegionBroker) target.getRegionBroker();
        return destination.isQueue() ?
                    regionBroker.getQueueRegion().getDestinationMap() :
                        regionBroker.getTopicRegion().getDestinationMap();
    }
View Full Code Here

                    }
                }
            } else if (brokerStats) {
                ActiveMQMapMessage statsMessage = new ActiveMQMapMessage();
                BrokerService brokerService = getBrokerService();
                RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
                SystemUsage systemUsage = brokerService.getSystemUsage();
                DestinationStatistics stats = regionBroker.getDestinationStatistics();
                statsMessage.setString("brokerName", regionBroker.getBrokerName());
                statsMessage.setString("brokerId", regionBroker.getBrokerId().toString());
                statsMessage.setLong("size", stats.getMessages().getCount());
                statsMessage.setLong("enqueueCount", stats.getEnqueues().getCount());
                statsMessage.setLong("dequeueCount", stats.getDequeues().getCount());
                statsMessage.setLong("dispatchCount", stats.getDispatched().getCount());
                statsMessage.setLong("expiredCount", stats.getExpired().getCount());
View Full Code Here

        }
        return createRegionBroker(destinationInterceptor);
    }

    protected Broker createRegionBroker(DestinationInterceptor destinationInterceptor) throws IOException {
        RegionBroker regionBroker;
        if (isUseJmx()) {
            regionBroker = new ManagedRegionBroker(this, getManagementContext(), getBrokerObjectName(),
                    getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor());
        } else {
            regionBroker = new RegionBroker(this, getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory,
                    destinationInterceptor,getScheduler(),getExecutor());
        }
        destinationFactory.setRegionBroker(regionBroker);
        regionBroker.setKeepDurableSubsActive(keepDurableSubsActive);
        regionBroker.setBrokerName(getBrokerName());
        regionBroker.getDestinationStatistics().setEnabled(enableStatistics);
        if (brokerId != null) {
            regionBroker.setBrokerId(brokerId);
        }
        return regionBroker;
    }
View Full Code Here

    public TransportConnection(TransportConnector connector, final Transport transport, Broker broker,
            TaskRunnerFactory taskRunnerFactory) {
        this.connector = connector;
        this.broker = broker;
        this.messageAuthorizationPolicy = connector.getMessageAuthorizationPolicy();
        RegionBroker rb = (RegionBroker) broker.getAdaptor(RegionBroker.class);
        brokerConnectionStates = rb.getConnectionStates();
        if (connector != null) {
            this.statistics.setParent(connector.getStatistics());
        }
        this.taskRunnerFactory = taskRunnerFactory;
        this.transport = transport;
View Full Code Here

       
        verifyStats(true);
    }

    private void verifyStats(boolean brokerRestarts) throws Exception {
        RegionBroker regionBroker = (RegionBroker) broker.getRegionBroker();
       
        for (Destination dest : regionBroker.getQueueRegion().getDestinationMap().values()) {
            DestinationStatistics stats = dest.getDestinationStatistics();
            if (brokerRestarts) {
                // all bets are off w.r.t stats as there may be duplicate sends and duplicate
                // dispatches, all of which will be suppressed - either by the reference store
                // not allowing duplicate references or consumers acking duplicates
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.region.RegionBroker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.