Package org.serviceconnector.api

Examples of org.serviceconnector.api.SCPublishMessage


    // publish n compressed messages 128 byte long. n is defined in the request body
    public void publishMessagesCompressed(SCMessage request, int operationTimeoutMillis) {
      String dataString = (String) request.getData();
      int count = Integer.parseInt(dataString);
      SCPublishMessage pubMessage = new SCPublishMessage(new byte[128]);
      pubMessage.setCompressed(true);
      for (int i = 0; i < count; i++) {
        try {
          pubMessage.setMask(TestConstants.maskSrv);
          pubMessage.setData("publish message nr:" + i);
          this.publishSrv.publish(pubMessage);
          if (((i + 1) % 1000) == 0) {
            TestPublishServer.testLogger.info("Publishing message nr. " + (i + 1));
          }
        } catch (Exception e) {
View Full Code Here


    // publish n uncompressed messages 128 byte long. n is defined in the request body
    public void publishMessagesUncompressed(SCMessage request, int operationTimeoutMillis) {
      String dataString = (String) request.getData();
      int count = Integer.parseInt(dataString);
      SCPublishMessage pubMessage = new SCPublishMessage(new byte[128]);
      pubMessage.setCompressed(false);
      for (int i = 0; i < count; i++) {
        try {
          pubMessage.setMask(TestConstants.maskSrv);
          pubMessage.setData("publish message nr:" + i);
          this.publishSrv.publish(pubMessage);
          if (((i + 1) % 1000) == 0) {
            TestPublishServer.testLogger.info("Publishing message nr. " + (i + 1));
          }
        } catch (Exception e) {
View Full Code Here

    // publish n messages 128 byte long with delay w. n is defined in the request body, w in messageInfo
    public void publishMessagesWithDelay(SCMessage request, int operationTimeoutMillis) {
      String[] dataString = ((String) request.getData()).split("\\|");
      int count = Integer.parseInt(dataString[0]);
      int waitTime = Integer.parseInt(dataString[1]);
      SCPublishMessage pubMessage = new SCPublishMessage(new byte[128]);
      pubMessage.setCompressed(false);
      pubMessage.setMask(TestConstants.maskSrv);
      pubMessage.setCacheId((String) request.getData());
      if (dataString.length >= 3) {
        String cacheId = dataString[2];
        pubMessage.setCacheId(cacheId);
      }
      if (dataString.length >= 4) {
        String cachingMethod = dataString[3];
        pubMessage.setCachingMethod(SC_CACHING_METHOD.getCachingMethod(cachingMethod));
      }
      for (int i = 0; i < count; i++) {
        try {
          pubMessage.setData("publish message nr:" + i);
          this.publishSrv.publish(pubMessage);
          Thread.sleep(waitTime);
          if (((i + 1) % 1000) == 0) {
            TestPublishServer.testLogger.info("Publishing message nr. " + (i + 1));
          }
View Full Code Here

    }

    // publish a large message
    public void publishLargeMessage(SCMessage request, int operationTimeoutMillis) {
      String largeString = TestUtil.getLargeString();
      SCPublishMessage pubMessage = new SCPublishMessage(largeString);
      pubMessage.setCompressed(false);
      try {
        Thread.sleep(1000);
        pubMessage.setMask(TestConstants.maskSrv);
        pubMessage.setData(largeString);
        this.publishSrv.publish(pubMessage);
        TestPublishServer.testLogger.info("publish message large message");
      } catch (Exception e) {
        LOGGER.error("cannot publish", e);
      }
View Full Code Here

      }
    }

    // publish 1 initial
    public void publish1Initial(SCMessage request, int operationTimeoutMillis) {
      SCPublishMessage initMessage = new SCPublishMessage();
      initMessage.setCacheId((String) request.getData());
      initMessage.setMask(TestConstants.maskSrv);
      initMessage.setCachingMethod(SC_CACHING_METHOD.INITIAL);
      try {
        this.publishSrv.publish(initMessage);
      } catch (Exception e) {
        LOGGER.error("cannot publish", e);
      }
View Full Code Here

      }
    }

    // publish large 1 initial
    public void publish1LargeInitial(SCMessage request, int operationTimeoutMillis) {
      SCPublishMessage initMessage = new SCPublishMessage();
      initMessage.setCacheId((String) request.getData());
      initMessage.setMask(TestConstants.maskSrv);
      initMessage.setCachingMethod(SC_CACHING_METHOD.INITIAL);
      initMessage.setData(TestUtil.getLargeString());
      try {
        this.publishSrv.publish(initMessage);
      } catch (Exception e) {
        LOGGER.error("cannot publish", e);
      }
View Full Code Here

      }
    }

    // publish 10MB initial
    public void publish10MBInitial(SCMessage request, int operationTimeoutMillis) {
      SCPublishMessage initMessage = new SCPublishMessage();
      initMessage.setCacheId((String) request.getData());
      initMessage.setMask(TestConstants.maskSrv);
      initMessage.setCachingMethod(SC_CACHING_METHOD.INITIAL);
      initMessage.setData(TestUtil.get10MBString());
      try {
        this.publishSrv.publish(initMessage);
      } catch (Exception e) {
        LOGGER.error("cannot publish", e);
      }
View Full Code Here

      }
    }

    // publish 1 initial 3 large appendix
    public void publish1Initial3LargeAppendix(SCMessage request, int operationTimeoutMillis) {
      SCPublishMessage pubMessage = new SCPublishMessage();
      pubMessage.setCacheId((String) request.getData());
      try {
        pubMessage.setCachingMethod(SC_CACHING_METHOD.INITIAL);
        pubMessage.setMask(TestConstants.maskSrv);
        pubMessage.setData("new init");
        this.publishSrv.publish(pubMessage);
        String largeString = TestUtil.getLargeString();
        pubMessage.setCachingMethod(SC_CACHING_METHOD.APPEND);
        pubMessage.setData("0:" + largeString);
        this.publishSrv.publish(pubMessage);
        Thread.sleep(200);
        pubMessage.setData("1" + largeString);
        this.publishSrv.publish(pubMessage);
        Thread.sleep(200);
        pubMessage.setData("2" + largeString);
        this.publishSrv.publish(pubMessage);
        TestPublishServer.testLogger.info("publish message large message");
      } catch (Exception e) {
        LOGGER.error("cannot publish", e);
      }
View Full Code Here

        pubMessage.setData("1" + largeString);
        this.publishSrv.publish(pubMessage);
        Thread.sleep(200);
        pubMessage.setData("2" + largeString);
        this.publishSrv.publish(pubMessage);
        SCPublishMessage initialMessage = new SCPublishMessage();
        initialMessage.setCacheId((String) request.getData());
        initialMessage.setMask(TestConstants.maskSrv);
        initialMessage.setCachingMethod(SC_CACHING_METHOD.INITIAL);
        this.publishSrv.publish(initialMessage);
        TestPublishServer.testLogger.info("publish message large message");
      } catch (Exception e) {
        LOGGER.error("cannot publish", e);
      }
View Full Code Here

TOP

Related Classes of org.serviceconnector.api.SCPublishMessage

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.