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) throws MyCQException |
| Create a CQ(Continuous Query) and CQResultQueue in a MyCQ Server.
|
void | deleteCQ (String cqName) throws MyCQException |
| Delete a CQ(Continuous Query).
|
void | deleteAllCQ () throws MyCQException |
| Delete all CQ(Continuous Query)s in a MyCQ Server.
|
String | getCQStatement (String cqName) throws MyCQException |
| Get a CQ(Continuous Query) statement in a MyCQ Server.
|
void | setHeartBeat (int msec) throws MyCQException |
| Set heart beat. (Heart beat is the speed value of continuous query scheduling.).
|
int | getHeartBeat () throws MyCQException |
| Get heart beat. (Heart beat is the speed value of continuous query scheduling.).
|
List< String > | getAllCQNames () throws MyCQException |
| Get all CQ(Continuous Query) names in a MyCQ Server.
|
List< String > | getCQNamesByQueueName (String queueName) throws MyCQException |
| Get all CQ(Continuous Query) names related to a queue name in a MyCQ Server.
|
Detailed Description
Manages continuous queries of a MyCQ Server.
import java.util.List;
import mycq.*;
public class ExamCQManager {
void examSetQueueSchema(QueueSchema queueSchema) {
try {
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");
} catch (MyCQException ex) {
System.out.println("code:" + ex.getCode() + ", message:"
+ ex.getMessage());
}
}
public void sample() {
MyCQClient client = MyCQFactory.getMyCQClient();
try {
client.connect("localhost", 3030, "root", "1234");
QueueManager queueManager = client.getQueueManager();
CQManager cqManager = client.getCQManager();
cqManager.deleteAllCQ();
queueManager.deleteAllQueues();
QueueSchema queueSchema = MyCQFactory.getQueueSchema();
examSetQueueSchema(queueSchema);
queueManager.createP2PQueue("p2pQueue", queueSchema, 100);
queueManager.createTopicQueue("topicQueue", queueSchema, 100);
String cq1 = "window p2pQueue as win1[size=30sec, slide=30sec] select count(*) from win1";
cqManager.createCQ("cq1", cq1, 100);
String cq2 = "window topicQueue as win1[size=30sec, slide=30sec] select count(*) from win1";
cqManager.createCQ("cq2", cq2, 100);
List<String> result;
result = cqManager.getAllCQNames();
for (String str : result) {
System.out.println(str);
System.out.println(cqManager.getCQStatement(str));
}
result = cqManager.getCQNamesByQueueName("p2pQueue");
for (String str : result) {
System.out.println(str);
}
cqManager.setHeartBeat(500);
System.out.println("heart beat:" + cqManager.getHeartBeat());
cqManager.setHeartBeat(1000);
System.out.println("heart beat:" + cqManager.getHeartBeat());
cqManager.deleteCQ("cq1");
cqManager.deleteAllCQ();
queueManager.deleteAllQueues();
} catch (MyCQException ex) {
System.out.println("code:" + ex.getCode() + ", message:"
+ ex.getMessage());
}
client.close();
}
}
Member Function Documentation
void mycq.CQManager.createCQ |
( |
String |
cqName, |
|
|
String |
cqStatement, |
|
|
int |
cqResultQueueSize | |
|
) |
| | throws MyCQException |
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 CQResultQueue to be created. |
- Exceptions:
-
| MyCQException | An error occurred while creating a new continuos query. |
Delete all CQ(Continuous Query)s in a MyCQ Server.
- Exceptions:
-
void mycq.CQManager.deleteCQ |
( |
String |
cqName |
) |
throws MyCQException |
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 |
( |
|
) |
throws MyCQException |
Get all CQ(Continuous Query) names in a MyCQ Server.
- Returns:
- CQ name list.
- Exceptions:
-
List<String> mycq.CQManager.getCQNamesByQueueName |
( |
String |
queueName |
) |
throws MyCQException |
Get all CQ(Continuous Query) names related to a queue name in a MyCQ Server.
- Parameters:
-
- Returns:
- CQ name list.
- Exceptions:
-
String mycq.CQManager.getCQStatement |
( |
String |
cqName |
) |
throws MyCQException |
Get a CQ(Continuous Query) statement in a MyCQ Server.
- Parameters:
-
| cqName | A continuous query name. |
- Returns:
- CQ statement.
- Exceptions:
-
Get heart beat. (Heart beat is the speed value of continuous query scheduling.).
- Returns:
- An integer(msec>=0) value of miliseconds.
- Exceptions:
-
void mycq.CQManager.setHeartBeat |
( |
int |
msec |
) |
throws MyCQException |
Set heart beat. (Heart beat is the speed value of continuous query scheduling.).
- Parameters:
-
| msec | An integer(msec>=0) value of miliseconds. |
- Exceptions:
-