Examples of DestinationStatistics


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

        };

        producingThread.start();
        producingThread.join();

        DestinationStatistics view = getDestinationStatistics(broker, destination);
        LOG.info("Stats: size: " + view.getMessages().getCount() + ", enqueues: "
                + view.getEnqueues().getCount() + ", dequeues: "
                + view.getDequeues().getCount() + ", dispatched: "
                + view.getDispatched().getCount() + ", inflight: "
                + view.getInflight().getCount() + ", expiries: "
                + view.getExpired().getCount());

        LOG.info("stopping broker");
        broker.stop();
        broker.waitUntilStopped();

        Thread.sleep(5000);

        LOG.info("recovering broker");
        final boolean deleteAllMessages = false;
        broker = createBroker(deleteAllMessages, 5000);

        Wait.waitFor(new Wait.Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                DestinationStatistics view = getDestinationStatistics(broker, destination);
                LOG.info("Stats: size: " + view.getMessages().getCount() + ", enqueues: "
                        + view.getEnqueues().getCount() + ", dequeues: "
                        + view.getDequeues().getCount() + ", dispatched: "
                        + view.getDispatched().getCount() + ", inflight: "
                        + view.getInflight().getCount() + ", expiries: "
                        + view.getExpired().getCount());

                return view.getMessages().getCount() == 0;
            }
        });

        view = getDestinationStatistics(broker, destination);
        assertEquals("Expect empty queue, QueueSize: ", 0, view.getMessages().getCount());
        assertEquals("all dequeues were expired", view.getDequeues().getCount(), view.getExpired().getCount());
    }
View Full Code Here

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

            recursiveDelete(new File(System.getProperty("derby.system.home")));
        }
    }
   
    public static DestinationStatistics getDestinationStatistics(BrokerService broker, ActiveMQDestination destination) {
        DestinationStatistics result = null;
        org.apache.activemq.broker.region.Destination dest = getDestination(broker, destination);
        if (dest != null) {
            result = dest.getDestinationStatistics();
        }
        return result;
View Full Code Here

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

        final PersistenceAdapter persistenceAdapter = brokerService
                .getPersistenceAdapter();
        final MessageStore queueMessageStore = persistenceAdapter
                .createQueueMessageStore(destination);
        final ConsumerInfo consumerInfo = new ConsumerInfo();
        final DestinationStatistics destinationStatistics = new DestinationStatistics();
        consumerInfo.setExclusive(true);

        final Queue queue = new Queue(brokerService, destination,
                queueMessageStore, destinationStatistics, null);
View Full Code Here

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

   
    private void validateConsumerPrefetch(String destination, long expectedCount) {
        RegionBroker regionBroker = (RegionBroker) broker.getRegionBroker();
        for (org.apache.activemq.broker.region.Destination dest : regionBroker.getQueueRegion().getDestinationMap().values()) {
            if (dest.getName().equals(destination)) {
                DestinationStatistics stats = dest.getDestinationStatistics();
                LOG.info("inflight for : " + dest.getName() + ": " + stats.getInflight().getCount());
                assertEquals("inflight for: " + dest.getName() + ": " + stats.getInflight().getCount() + " matches",
                        expectedCount, stats.getInflight().getCount());     
            }
        }
    }
View Full Code Here

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

            if (destStats) {
                String queueryName = physicalName.substring(STATS_DESTINATION_PREFIX.length(), physicalName.length());
                ActiveMQDestination queryDest = ActiveMQDestination.createDestination(queueryName,msgDest.getDestinationType());
                Set<Destination> set = getDestinations(queryDest);
                for (Destination dest : set) {
                    DestinationStatistics stats = dest.getDestinationStatistics();
                    if (stats != null) {
                        ActiveMQMapMessage statsMessage = new ActiveMQMapMessage();
                        statsMessage.setString("destinationName", dest.getActiveMQDestination().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());
                        statsMessage.setLong("inflightCount", stats.getInflight().getCount());
                        statsMessage.setLong("messagesCached", stats.getMessagesCached().getCount());
                        statsMessage.setInt("memoryPercentUsage", dest.getMemoryUsage().getPercentUsage());
                        statsMessage.setLong("memoryUsage", dest.getMemoryUsage().getUsage());
                        statsMessage.setLong("memoryLimit", dest.getMemoryUsage().getLimit());
                        statsMessage.setDouble("averageEnqueueTime", stats.getProcessTime().getAverageTime());
                        statsMessage.setDouble("maxEnqueueTime", stats.getProcessTime().getMaxTime());
                        statsMessage.setDouble("minEnqueueTime", stats.getProcessTime().getMinTime());
                        statsMessage.setLong("consumerCount", stats.getConsumers().getCount());
                        statsMessage.setLong("producerCount", stats.getProducers().getCount());
                        sendStats(producerExchange.getConnectionContext(), statsMessage, replyTo);
                    }
                }
            } 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());
                statsMessage.setLong("inflightCount", stats.getInflight().getCount());
                statsMessage.setLong("messagesCached", stats.getMessagesCached().getCount());
                statsMessage.setInt("memoryPercentUsage", systemUsage.getMemoryUsage().getPercentUsage());
                statsMessage.setLong("memoryUsage", systemUsage.getMemoryUsage().getUsage());
                statsMessage.setLong("memoryLimit", systemUsage.getMemoryUsage().getLimit());
                statsMessage.setInt("storePercentUsage", systemUsage.getStoreUsage().getPercentUsage());
                statsMessage.setLong("storeUsage", systemUsage.getStoreUsage().getUsage());
                statsMessage.setLong("storeLimit", systemUsage.getStoreUsage().getLimit());
                statsMessage.setInt("tempPercentUsage", systemUsage.getTempUsage().getPercentUsage());
                statsMessage.setLong("tempUsage", systemUsage.getTempUsage().getUsage());
                statsMessage.setLong("tempLimit", systemUsage.getTempUsage().getLimit());
                statsMessage.setDouble("averageEnqueueTime", stats.getProcessTime().getAverageTime());
                statsMessage.setDouble("maxEnqueueTime", stats.getProcessTime().getMaxTime());
                statsMessage.setDouble("minEnqueueTime", stats.getProcessTime().getMinTime());
                statsMessage.setLong("consumerCount", stats.getConsumers().getCount());
                statsMessage.setLong("producerCount", stats.getProducers().getCount());
                String answer = brokerService.getTransportConnectorURIsAsMap().get("tcp");
                answer = answer != null ? answer : "";
                statsMessage.setString("openwire", answer);
                answer = brokerService.getTransportConnectorURIsAsMap().get("stomp");
                answer = answer != null ? answer : "";
View Full Code Here

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

            final org.apache.activemq.broker.region.Destination target = dest;
            if (dest.getName().equals(destination)) {
                try {
                    Wait.waitFor(new Condition() {
                        public boolean isSatisified() throws Exception {
                            DestinationStatistics stats = target.getDestinationStatistics();
                            LOG.info("inflight for : " + target.getName() + ": " +  stats.getInflight().getCount());
                            return stats.getInflight().getCount() == expectedCount;
                        }
                    });
                } catch (Exception e) {
                    throw new JMSException(e.toString());
                }
                DestinationStatistics stats = dest.getDestinationStatistics();
                LOG.info("inflight for : " + dest.getName() + ": " + stats.getInflight().getCount());
                assertEquals("inflight for: " + dest.getName() + ": " + stats.getInflight().getCount() + " matches",
                        expectedCount, stats.getInflight().getCount());     
            }
        }
    }
View Full Code Here

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

    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
                LOG.info("with restart: not asserting qneue/dequeue stat match for: " + dest.getName()
                        + " " + stats.getEnqueues().getCount() + " <= " +stats.getDequeues().getCount());
            } else {
                assertEquals("qneue/dequeue match for: " + dest.getName(),
                        stats.getEnqueues().getCount(), stats.getDequeues().getCount());  
            }
        }
    }
View Full Code Here

Examples of org.apache.geronimo.console.jmsmanager.DestinationStatistics

                        logger.warn("PhysicalName undefined, using queueName as PhysicalName");
                        physicalName = queueName;
                    }
                    String destType = admins[j].getAdminObjectInterface().indexOf("Queue") > -1 ? "Queue" : "Topic";
                    String vendorName = module.getVendorName();
                    DestinationStatistics destinationStat = null;
                    if (physicalName != null) {                       
                        try {
                            JMSDestinationInfo jmsDestinationInfo = new JMSDestinationInfo();
                            jmsDestinationInfo.setPhysicalName(physicalName);
                            jmsDestinationInfo.setType(destType);
                            jmsDestinationInfo.setResourceAdapterModuleAbName(PortletManager.getNameFor(renderRequest, module));
                            destinationStat = JMSMessageHelperFactory.getJMSMessageHelper(vendorName).getDestinationStatistics(renderRequest, jmsDestinationInfo);
                        } catch (JMSException e) {
                            destinationStat = new DestinationStatistics();
                        }
                    }
                    AdminObjectSummary adminObjectSummary = new AdminObjectSummary(bean.getObjectName(), queueName, physicalName, destType, bean.getState(), destinationStat);                                       
                    adminObjectSummary.setQueueBrowserSupported(true);
                    adminObjectSummary.setTopicHistoryBrowserSupported(false);
View Full Code Here

Examples of org.apache.geronimo.console.jmsmanager.DestinationStatistics

        }
    }

    @Override
    public DestinationStatistics getDestinationStatistics(PortletRequest portletRequest, JMSDestinationInfo destinationInfo) throws JMSException {
        DestinationStatistics stat = new DestinationStatistics();
        try {
            BrokerInfo brokerInfo = getBrokerInfo(portletRequest, destinationInfo);
            if (brokerInfo == null || !isInLocalMBeanServer(brokerInfo)) {
                return stat;
            }
            MBeanServer server = getMBeanServer();
            ObjectName objName = createDestinationObjectName(brokerInfo.getBrokerName(), destinationInfo.getType().name(), destinationInfo.getPhysicalName());
            DestinationViewMBean proxy;
            if (destinationInfo.getType().equals(DestinationType.Queue)) {
                if (!server.isRegistered(objName)) {
                    // mbean is not yet registered.Adding the destination to activemq broker.
                    ObjectName brokerObj = createBrokerObjectName(brokerInfo.getBrokerName());
                    Set set = server.queryMBeans(brokerObj, null);
                    Iterator it = set.iterator();
                    if (it.hasNext()) {
                        ObjectInstance instance = (ObjectInstance) it.next();
                        brokerObj = instance.getObjectName();
                    }
                    BrokerViewMBean brokerMBean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, brokerObj, BrokerViewMBean.class, true);
                    brokerMBean.addQueue(destinationInfo.getPhysicalName());
                }
                proxy = (DestinationViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, objName, QueueViewMBean.class, true);
            } else {
                if (!server.isRegistered(objName)) {
                    // mbean is not yet registered.Adding the destination to activemq broker.
                    ObjectName brokerObj = createBrokerObjectName(brokerInfo.getBrokerName());
                    Set set = server.queryMBeans(brokerObj, null);
                    Iterator it = set.iterator();
                    if (it.hasNext()) {
                        ObjectInstance instance = (ObjectInstance) it.next();
                        brokerObj = instance.getObjectName();
                    }
                    BrokerViewMBean brokerMBean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, brokerObj, BrokerViewMBean.class, true);
                    brokerMBean.addTopic(destinationInfo.getPhysicalName());
                }
                proxy = (DestinationViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, objName, TopicViewMBean.class, true);
            }
            stat.setConsumerCount(proxy.getConsumerCount());
            stat.setEnqueueCount(proxy.getEnqueueCount());
            stat.setDequeueCount(proxy.getDequeueCount());
            stat.setQueueSize(proxy.getQueueSize());
        } catch (Exception ex) {
            logger.warn("Failed to get ActiveMQ stats", ex);
        }
        return stat;
    }
View Full Code Here

Examples of org.apache.geronimo.console.jmsmanager.DestinationStatistics

                        logger.warn("PhysicalName undefined, using queueName as PhysicalName");
                        physicalName = queueName;
                    }
                    String destType = admins[j].getAdminObjectInterface().indexOf("Queue") > -1 ? "Queue" : "Topic";
                    String vendorName = module.getVendorName();
                    DestinationStatistics destinationStat = null;
                    if (physicalName != null) {                       
                        try {
                            JMSDestinationInfo jmsDestinationInfo = new JMSDestinationInfo();
                            jmsDestinationInfo.setPhysicalName(physicalName);
                            jmsDestinationInfo.setType(destType);
                            jmsDestinationInfo.setResourceAdapterModuleAbName(PortletManager.getNameFor(renderRequest, module));
                            destinationStat = JMSMessageHelperFactory.getJMSMessageHelper(vendorName).getDestinationStatistics(renderRequest, jmsDestinationInfo);
                        } catch (JMSException e) {
                            destinationStat = new DestinationStatistics();
                        }
                    }
                    AdminObjectSummary adminObjectSummary = new AdminObjectSummary(abstractName.getObjectName().toString(), queueName, physicalName, destType, kernel.getGBeanState(abstractName), destinationStat);                                       
                    adminObjectSummary.setQueueBrowserSupported(true);
                    adminObjectSummary.setTopicHistoryBrowserSupported(false);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.