User: norbert
Date: 00/05/17 16:43:07
Modified: examples TestClient.java
Log:
Very basic selector system ( there's no parser yet )
Revision Changes Path
1.21 +20 -3 spyderMQ/examples/TestClient.java
Index: TestClient.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/examples/TestClient.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- TestClient.java 2000/05/16 03:56:11 1.20
+++ TestClient.java 2000/05/17 23:43:07 1.21
@@ -29,6 +29,10 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
+//test for selectors
+import org.spydermq.selectors.*;
+import org.spydermq.SpyMessage;
+import java.util.HashSet;
//This is a very simple parser which uses the JMS server : it can dynamically use
JMS objects
//
@@ -71,7 +75,7 @@
return true;
}
- if (str.equals("publish")) {
+ if (str.equals("pub")) {
Topic dest = (Topic)new
InitialContext().lookup("topic/"+(String)objects[0]);
TextMessage content=session.createTextMessage();
content.setText((String)objects[1]);
@@ -245,7 +249,20 @@
prop=new Properties();
prop.put("c",connection);
prop.put("s",session);
-
+ prop.put("p",publisher);
+
+ //Test for selectors
+ Identifier id1=new Identifier("id1");
+ Operator op1=new Operator(Operator.EQUAL,id1,"ex");
+ Operator op2=new Operator(Operator.EQUAL,id1,"ex2");
+ Operator op3=new Operator(Operator.OR,op1,op2);
+
+ HashSet identifiers=new HashSet();
+ identifiers.add(id1);
+ Selector sel=new Selector(identifiers,op3);
+
+ prop.put("selector",sel);
+
while (true) {
try {
@@ -263,7 +280,7 @@
e.printStackTrace();
}
- }
+ }
}
}