MyCQ.CQManager Interface Reference

Manages continuous queries of a MyCQ Server. More...

List of all members.

Public Member Functions

void createCQ (string cqName, string cqStatement, int cqResultQueueSize)
 Create a CQ(Continuous Query) and CQResultQueue in a MyCQ Server.
void deleteCQ (string cqName)
 Delete a CQ(Continuous Query).
void deleteAllCQ ()
 Delete all CQ(Continuous Query)s in a MyCQ Server.
string getCQStatement (string cqName)
 Get a CQ(Continuous Query) statement in a MyCQ Server.
void setHeartBeat (int msec)
 Set heart beat. (Heart beat is the speed value of continuous query scheduling.).
int getHeartBeat ()
 Get heart beat. (Heart beat is the speed value of continuous query scheduling.).
List< string > getAllCQNames ()
 Get all CQ(Continuous Query) names in a MyCQ Server.
List< string > getCQNamesByQueueName (string queueName)
 Get all CQ(Continuous Query) names related to a queue name in a MyCQ Server.

Detailed Description

Manages continuous queries of a MyCQ Server.

using System;
using System.Collections.Generic;
using MyCQ;

namespace MyCQClientNETExample
{
    class ExamCQManager
    {
        void examSetQueueSchema(QueueSchema queueSchema)
        {
            queueSchema.addBoolean("boolean");
            queueSchema.addByte("byte");
            queueSchema.addShort("short");
            queueSchema.addUShort("ushort");
            queueSchema.addInt("int");
            queueSchema.addLong("long");
            queueSchema.addFloat("float");
            queueSchema.addDouble("double");
            queueSchema.addDate("date");
            queueSchema.addTime("time");
            queueSchema.addDateTime("datetime");
            queueSchema.addString("string", 100);
            queueSchema.addVarString("varstring");
            queueSchema.addBinary("binary", 100);
            queueSchema.addVarBinary("varbinary");

            //columns
            //col 0: boolean
            //col 1: byte
            //col 2: short
            //col 3: ushort
            //col 4: int
            //col 5: long
            //col 6: float
            //col 7: double
            //col 8: date
            //col 9: time
            //col10: datetime
            //col11: string
            //col12: varstring
            //col13: binary
            //col14: varbinary
        }

        public void sample()
        {
            //get client instance
            MyCQClient client = MyCQFactory.getMyCQClient();

            try
            {
                //connect
                client.connect("localhost", 3030, "root", "1234");

                //get queue manager
                QueueManager queueManager = client.getQueueManager();

                //get cq manager
                CQManager cqManager = client.getCQManager();

                cqManager.deleteAllCQ();
                queueManager.deleteAllQueues();

                //Queue Schema
                //get queue schema instance
                QueueSchema queueSchema = MyCQFactory.getQueueSchema();

                //set queue schema
                examSetQueueSchema(queueSchema);

                //create queues for CQ
                queueManager.createP2PQueue("p2pQueue", queueSchema, 100);
                queueManager.createTopicQueue("topicQueue", queueSchema, 100);


                //create cq
                string cq1 = "window p2pQueue as win1[size=30sec, slide=30sec] select count(*) from win1";
                cqManager.createCQ("cq1", cq1, 100);

                //create cq
                string cq2 = "window topicQueue as win1[size=30sec, slide=30sec] select count(*) from win1";
                cqManager.createCQ("cq2", cq2, 100);


                //get all cq names
                List<string> result;
                result = cqManager.getAllCQNames();
                foreach (string str in result)
                {
                    Console.WriteLine(str);
                    Console.WriteLine(cqManager.getCQStatement(str));
                }

                //get cq names by queue name
                result = cqManager.getCQNamesByQueueName("p2pQueue");
                foreach (string str in result)
                {
                    Console.WriteLine(str);
                }

                //set heart beat, get heart beat
                cqManager.setHeartBeat(500);
                Console.WriteLine("heart beat:" + cqManager.getHeartBeat());

                cqManager.setHeartBeat(1000);
                Console.WriteLine("heart beat:" + cqManager.getHeartBeat());

                //delete cq
                cqManager.deleteCQ("cq1");

                //delete all cq
                cqManager.deleteAllCQ();

                //delete all queues
                queueManager.deleteAllQueues();

            }
            catch (MyCQException ex)
            {
                Console.WriteLine("code:" + ex.getCode() + ", message:" + ex.getMessage());
            }

            //close connection
            client.close();
        }
    }
}

Member Function Documentation

void MyCQ.CQManager.createCQ ( string  cqName,
string  cqStatement,
int  cqResultQueueSize 
)

Create a CQ(Continuous Query) and CQResultQueue in a MyCQ Server.

Parameters:
cqName A continuous query name to create. CQResultQueue name will be the equal name to cq name. (size:= under 64). A cq name is a combination of alphabets and numerics which starts with alphabet character.
cqStatement A continuous query statement. See MyCQL documents.
cqResultQueueSize An integer greater than zero that will be the size of a cq result queue to be created.
Exceptions:
MyCQException An error occurred while creating a new continuos query.
void MyCQ.CQManager.deleteAllCQ (  ) 

Delete all CQ(Continuous Query)s in a MyCQ Server.

Exceptions:
MyCQException An error occurred while deleting all the CQs.
void MyCQ.CQManager.deleteCQ ( string  cqName  ) 

Delete a CQ(Continuous Query).

Parameters:
cqName A continuous query name to delete.
Exceptions:
MyCQException An error occurred while deleting a continuos query.
List<string> MyCQ.CQManager.getAllCQNames (  ) 

Get all CQ(Continuous Query) names in a MyCQ Server.

Returns:
CQ name list.
Exceptions:
MyCQException An error occurred while getting all the cq names.
List<string> MyCQ.CQManager.getCQNamesByQueueName ( string  queueName  ) 

Get all CQ(Continuous Query) names related to a queue name in a MyCQ Server.

Parameters:
queueName A queue name.
Returns:
CQ name list.
Exceptions:
MyCQException An error occurred while getting all the cq names.
string MyCQ.CQManager.getCQStatement ( string  cqName  ) 

Get a CQ(Continuous Query) statement in a MyCQ Server.

Parameters:
cqName A continuous query name.
Returns:
CQ statement.
Exceptions:
MyCQException An error occurred while getting a cq statement.
int MyCQ.CQManager.getHeartBeat (  ) 

Get heart beat. (Heart beat is the speed value of continuous query scheduling.).

Returns:
An integer(msec>=0) value of miliseconds.
Exceptions:
MyCQException An error occurred while getting a heart beat.
void MyCQ.CQManager.setHeartBeat ( int  msec  ) 

Set heart beat. (Heart beat is the speed value of continuous query scheduling.).

Parameters:
msec An integer(msec>=0) value of miliseconds.
Exceptions:
MyCQException An error occurred while setting a heart beat.

The documentation for this interface was generated from the following file:
 All Classes Functions Variables Properties
MyCQ .NET User's Document. Copyright@MyCQ Inc., All Rights Reserved.