Package org.apache.qpid.qmf2.console

Examples of org.apache.qpid.qmf2.console.SubscribeParams


    private void createQueueSubscription()
    {
        try
        {   // This QmfQuery simply does an ID query for objects with the className "queue"
            QmfQuery query = new QmfQuery(QmfQueryTarget.OBJECT, new SchemaClassId("queue"));
            SubscribeParams params = _console.createSubscription(_broker, query, "queueStatsHandle");
            _subscriptionId = params.getSubscriptionId();
            _subscriptionDuration = params.getLifetime() - 10; // Subtract 10 as we want to refresh before it times out
            _startTime = System.currentTimeMillis();
        }
        catch (QmfException qmfe)
        {
        }
View Full Code Here


                System.exit(1);
            }

            System.out.println("Creating Query for objects whose name property has a value that starts with 'a'");

            SubscribeParams params;
            QmfQuery query = new QmfQuery(QmfQueryTarget.OBJECT, "['re_match', 'name', ['quote', '^a']]");

            // Create a subscription, response returned synchronously
            params = _console.createSubscription(_broker, query, "consoleHandle1", "{publishInterval:5}");
            System.out.println("duration = " + params.getLifetime());
            System.out.println("interval = " + params.getPublishInterval());
            System.out.println("subscriptionId = " + params.getSubscriptionId());
            System.out.println("consoleHandle = " + params.getConsoleHandle());

            // Sleep a while, getting query result as they become available
            try
            {
                Thread.sleep(20000);
            }
            catch (InterruptedException ie)
            {
            }

            // Refresh the subscription getting results asynchronously, just for variety
            System.out.println("Calling refreshSubscription on " + params.getSubscriptionId());
            _console.refreshSubscription(params.getSubscriptionId(), "{replyHandle:ignoredReplyHandle}");


            // Create a subscription for _class_name = queue
            System.out.println("Creating Query for all queue objects");
            query = new QmfQuery(QmfQueryTarget.OBJECT, "['eq', '_class_name', ['quote', 'queue']]");
            params = _console.createSubscription(_broker, query, "queues");

            while (_objectId == null)
            {
                System.out.println("Waiting for ObjectId to be set");
                try
                {
                    Thread.sleep(1000);
                }
                catch (InterruptedException ie)
                {
                }
            }

            // Cancel the query for all queue objects
            System.out.println("Cancelling Query for all queue objects");
            _console.cancelSubscription(params.getSubscriptionId());

            // Create a subscription for _object_id
            System.out.println("Creating Query for _object_id = " + _objectId);
            query = new QmfQuery(QmfQueryTarget.OBJECT, _objectId);
            params = _console.createSubscription(_broker, query, "queues");
View Full Code Here

        }

        if (wi.getType() == SUBSCRIBE_RESPONSE)
        {
            SubscribeResponseWorkItem item = (SubscribeResponseWorkItem)wi;
            SubscribeParams params = item.getSubscribeParams();
            System.out.println("duration = " + params.getLifetime());
            System.out.println("interval = " + params.getPublishInterval());
            System.out.println("subscriptionId = " + params.getSubscriptionId());
            System.out.println("consoleHandle = " + params.getConsoleHandle());
            String correlationId = item.getHandle().getCorrelationId();
            System.out.println("correlationId = " + correlationId);
        }

        if (wi.getType() == SUBSCRIPTION_INDICATION)
View Full Code Here

                System.exit(1);
            }

            System.out.println("Creating Query for objects whose state property has a value that starts with 'OP'");

            SubscribeParams params;
            QmfQuery query = new QmfQuery(QmfQueryTarget.OBJECT, "['re_match', 'state', ['quote', '^OP']]");

            // Create a subscription, response returned synchronously
            params = _console.createSubscription(_gizmo, query, "consoleHandle1", "{publishInterval:5}");
            System.out.println("duration = " + params.getLifetime());
            System.out.println("interval = " + params.getPublishInterval());
            System.out.println("subscriptionId = " + params.getSubscriptionId());
            System.out.println("consoleHandle = " + params.getConsoleHandle());

            // Sleep a while, getting query result as they become available
            try
            {
                Thread.sleep(20000);
            }
            catch (InterruptedException ie)
            {
            }

            // Refresh the subscription getting results asynchronously, just for variety
            System.out.println("Calling refreshSubscription on " + params.getSubscriptionId());
            _console.refreshSubscription(params.getSubscriptionId(), "{replyHandle:ignored}");


            // Sleep a bit more
            try
            {
View Full Code Here

        }

        if (wi.getType() == SUBSCRIBE_RESPONSE)
        {
            SubscribeResponseWorkItem item = (SubscribeResponseWorkItem)wi;
            SubscribeParams params = item.getSubscribeParams();
            System.out.println("duration = " + params.getLifetime());
            System.out.println("interval = " + params.getPublishInterval());
            System.out.println("subscriptionId = " + params.getSubscriptionId());
            System.out.println("consoleHandle = " + params.getConsoleHandle());
            String correlationId = item.getHandle().getCorrelationId();
            System.out.println("correlationId = " + correlationId);
        }

        if (wi.getType() == SUBSCRIPTION_INDICATION)
View Full Code Here

    private void createQueueSubscription()
    {
        try
        {   // This QmfQuery simply does an ID query for objects with the className "queue"
            QmfQuery query = new QmfQuery(QmfQueryTarget.OBJECT, new SchemaClassId("queue"));
            SubscribeParams params = _console.createSubscription(_broker, query, "queueStatsHandle");
            _subscriptionId = params.getSubscriptionId();
            _subscriptionDuration = params.getLifetime() - 10; // Subtract 10 as we want to refresh before it times out
            _startTime = System.currentTimeMillis();
        }
        catch (QmfException qmfe)
        {
        }
View Full Code Here

        {
            _objects.clear();
        }
        else if (wi instanceof SubscriptionIndicationWorkItem)
        {
            SubscriptionIndicationWorkItem item = (SubscriptionIndicationWorkItem)wi;
            SubscribeIndication indication = item.getSubscribeIndication();
            String correlationId = indication.getConsoleHandle();
            if (correlationId.equals("queueStatsHandle"))
            { // If it is (and it should be!!) then it's our queue object Subscription
                List<QmfConsoleData> data = indication.getData();
                for (QmfConsoleData record : data)
View Full Code Here

        try
        {
            String host = "localhost";
            String connectionOptions = "{reconnect: true}";
            List<Pattern> filter = new ArrayList<Pattern>();
            GetOpt getopt = new GetOpt(args, "ha:f:", longOpts);
            List<String[]> optList = getopt.getOptList();

            for (String[] opt : optList)
            {
                if (opt[0].equals("-h") || opt[0].equals("--help"))
                {
View Full Code Here

        String[] longOpts = {"help", "whitelist=", "sasl-mechanism="};
        try
        {
            String connectionOptions = "{reconnect: true}";
            String whitelist = "./whitelist.xml";
            GetOpt getopt = new GetOpt(args, "h", longOpts);
            List<String[]> optList = getopt.getOptList();
            String[] cargs = {};
            cargs = getopt.getEncArgs().toArray(cargs);
            for (String[] opt : optList)
            {
                if (opt[0].equals("-h") || opt[0].equals("--help"))
                {
                    System.out.println(_usage);
View Full Code Here

        {
            String host = "localhost";
            String connectionOptions = "{reconnect: true}";
            boolean logQueues = false;

            GetOpt getopt = new GetOpt(args, "ha:q", longOpts);
            List<String[]> optList = getopt.getOptList();
            String[] cargs = {};
            cargs = getopt.getEncArgs().toArray(cargs);

            for (String[] opt : optList)
            {
                if (opt[0].equals("-h") || opt[0].equals("--help"))
                {
View Full Code Here

TOP

Related Classes of org.apache.qpid.qmf2.console.SubscribeParams

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.