Package org.xmlBlaster.client

Examples of org.xmlBlaster.client.I_XmlBlasterAccess.publish()


                           "   <DispatchTest>" +
                           "   </DispatchTest>" +
                           "</key>";
         String content = "Some content #1";
         MsgUnit msgUnit = new MsgUnit(xmlKey, content.getBytes(), "<qos></qos>");
         publishOid1 = blasterConnection.publish(msgUnit).getKeyOid();
         log.info("Publishing done, returned oid=" + publishOid1);

         try { Thread.sleep(1000); } catch( InterruptedException i) {} // Wait a second

         String publishOid2 = "";
View Full Code Here


         String publishOid2 = "";
         xmlKey = "<key oid='A message id' contentMime='text/xml'>\n" +
                  "</key>";
         content = "Some content #2";
         msgUnit = new MsgUnit(xmlKey, content.getBytes(), "<qos></qos>");
         publishOid2 = blasterConnection.publish(msgUnit).getKeyOid();
         log.info("Publishing done, returned oid=" + publishOid2);


         try { Thread.sleep(1000); } catch( InterruptedException i) {} // Wait a second
View Full Code Here

            conn.connect(qos, this);
            PublishKey pubKey = new PublishKey(global, topicName);
            PublishQos pubQos = new PublishQos(global);
            for (int i=0; i < 5; i++) {
               String content = "This is test " + i;
               conn.publish(new MsgUnit(pubKey, content.getBytes(), pubQos));
            }
           
            int ret = msgInterceptor.waitOnUpdate(3000L, 1);
            assertEquals("We expected one message for the excess of the history queue", 1, ret);
            msgInterceptor.clear();
View Full Code Here

            int ret = msgInterceptor.waitOnUpdate(3000L, 1);
            assertEquals("We expected one message for the excess of the history queue", 1, ret);
            msgInterceptor.clear();
            for (int i=5; i < 8; i++) {
               String content = "This is test " + i;
               conn.publish(new MsgUnit(pubKey, content.getBytes(), pubQos));
            }
            ret = msgInterceptor.waitOnUpdate(3000L, 1);
            assertEquals("We expected one message", 1, ret);
            msgInterceptor.clear();
            conn.disconnect(new DisconnectQos(global));
View Full Code Here

            conn.connect(qos, this);
            PublishKey pubKey = new PublishKey(global, topicName);
            PublishQos pubQos = new PublishQos(global);
            for (int i=0; i < 5; i++) {
               String content = "This is test " + i;
               conn.publish(new MsgUnit(pubKey, content.getBytes(), pubQos));
            }
           
            int ret = msgInterceptor.waitOnUpdate(3000L, 1);
            assertEquals("We expected one message for the excess of the history queue", 1, ret);
            msgInterceptor.clear();
View Full Code Here

            int ret = msgInterceptor.waitOnUpdate(3000L, 1);
            assertEquals("We expected one message for the excess of the history queue", 1, ret);
            msgInterceptor.clear();
            for (int i=5; i < 8; i++) {
               String content = "This is test " + i;
               conn.publish(new MsgUnit(pubKey, content.getBytes(), pubQos));
            }
            ret = msgInterceptor.waitOnUpdate(3000L, 2);
            assertEquals("We expected two messages: one for the excess of the callback queue and the other for the excess of the history queue of the __sys__Event topic", 2, ret);
            msgInterceptor.clear();
            conn.disconnect(new DisconnectQos(global));
View Full Code Here

         qos.setPtpAllowed(false);
         qos.setUserId("A-NATIVE-CLIENT-PLUGIN");
         qos.getSessionQos().setSessionTimeout(0L);
         con.connect(qos, null);    // Login to xmlBlaster as "A-NATIVE-CLIENT-PLUGIN"
         //Here we can publish or subscribe etc., see HelloWorld3.java how to do it
         con.publish(new MsgUnit(glob, "<key oid='TEST'/>", "Hi", "<qos/>"));
         //con.disconnect(null);
      }
      catch (Exception e) {
         System.err.println("HelloWorldNative: We have a problem: " + e.toString());
      }
View Full Code Here

            String content = "<person><name>Ghandi</name></person>";
            MsgUnit msgUnit = new MsgUnit(xmlKey, content.getBytes(), "");
            log.fine("Publishing ...");
            stop.restart();
            try {
               publishOid = blasterConnection.publish(msgUnit).getKeyOid();
               log.info("   Returned oid=" + publishOid);
               log.fine("Publishing done" + stop.nice());
            } catch(XmlBlasterException e) {
               log.severe("Punlishing failed, XmlBlasterException: " + e.getMessage());
            }
View Full Code Here

               xmlKey = "<key oid='" + publishOid + "' contentMime='text/xml'>\n</key>";
               MsgUnit msgUnit = new MsgUnit(xmlKey, content.getBytes(), "");
               log.fine("Publishing ...");
               stop.restart();
               try {
                  String str = blasterConnection.publish(msgUnit).getKeyOid();
                  log.fine("Publishing done" + stop.nice());
               } catch(XmlBlasterException e) {
                  log.severe("Publishing failed, XmlBlasterException: " + e.getMessage());
               }
            }
View Full Code Here

                           "   <TestLogin-AGENT>" +
                           "   </TestLogin-AGENT>" +
                           "</key>";
         String senderContent = "Some content";
         MsgUnit msgUnit = new MsgUnit(xmlKey, senderContent.getBytes(), "<qos></qos>");
         conn.publish(msgUnit);

      }
      catch (Throwable t) {
         assertTrue( "Some error occured:"+t.toString(), true );
      }
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.