Examples of WseMsgBrokerClient


Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

        this.workflow = workflow;
        this.brokerURL = configuration.getBrokerURL();
        this.topic = configuration.getTopic();
        this.pullMode = true;
        this.messageBoxURL = configuration.getMessageBoxURL();
        this.wseClient = new WseMsgBrokerClient();
        this.wseClient.init(this.brokerURL.toString());
        this.workflowInterpreterConfiguration = WorkflowInterpreter.getWorkflowInterpreterConfiguration();
        this.workflowNodeStatusUpdater = new WorkflowNodeStatusUpdater(this.workflowInterpreterConfiguration.getAiravataAPI());
        this.workflowStatusUpdater = new WorkflowStatusUpdater(this.workflowInterpreterConfiguration.getAiravataAPI());
    }
View Full Code Here

Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

                null, testCallback1);

        System.out.println(subscription.getMessageBoxEPR());
        System.out.println(subscription.getSubscriptionID());

        WseMsgBrokerClient client = new WseMsgBrokerClient();
        client.init(BROKER_URL);

        OMElement msg = WorkFlowUtils.reader2OMElement(new StringReader(CommonUtils.WORKFLOW_INITIALIZED_NOTIFICATION));

        client.publish(TEST_TOPIC, msg);

        EndpointReference MSG_BOX_EPR = subscription.getMessageBoxEPR();
        System.out.println(MSG_BOX_EPR);
        String subscriptionID = subscription.getSubscriptionID();
        Callback testCallback2 = new Callback() {
View Full Code Here

Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

    @Test
    public void testRenewSubscription() throws Exception {
        Subscription sub = LeadNotificationManager.createMessageBoxSubscription(MESSAGEBOX_URL, BROKER_URL, TOPIC,
                null, this, false);

        WseMsgBrokerClient client = new WseMsgBrokerClient();
        client.init(BROKER_URL);

        OMElement msg = OMAbstractFactory.getOMFactory().createOMElement("test", null);
        msg.setText("mustwork");
        client.publish(TOPIC, msg);
        // sub.destroy();

        msg.setText("destroyed");
        client.publish(TOPIC, msg);
        Subscription sub2 = LeadNotificationManager.renewMessageboxSubscription(BROKER_URL, sub.getMessageBoxEPR(),
                sub.getSubscriptionID(), TOPIC, null, false);

        msg.setText("mustworkagain");
        client.publish(TOPIC, msg);

        System.out.println(sub2.getSubscriptionID());
        while (counter < 2) {
            Thread.sleep(1000);
        }
View Full Code Here

Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

        }

        Thread.sleep(100);

        WseMsgBrokerClient client = new WseMsgBrokerClient();
        client.init(BROKER_URL);

        OMElement msg = WorkFlowUtils.reader2OMElement(new StringReader(CommonUtils.WORKFLOW_INITIALIZED_NOTIFICATION));

        for (int j = 0; j < NUMBER_OF_SUBSCRIBERS; j++) {
            for (int i = 0; i < NOTIFICATIONS_PUBLISHED; i++) {

                client.publish(TEST_TOPIC, msg);

                Thread.sleep(100);
            }
        }
View Full Code Here

Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

        .getProperty(ConfigKeys.TOPIC_SIMPLE);

    int timeInterval = Integer.parseInt(configurations
        .getProperty(ConfigKeys.PUBLISH_TIME_INTERVAL));

    WseMsgBrokerClient client = new WseMsgBrokerClient();
    client.init(brokerLocation);

    try {

      int count = 0;
      while (true) {
        UUID uuid = UUID.randomUUID();
        count++;
        OMElement omMsg = createMsg(count, getName(), uuid.toString());
        System.out.println(String.format(
            "producer [%s] sending msg: %s", getName(), omMsg
                .toString()));

        client.publish(topicExpression, omMsg);

        TimeUnit.SECONDS.sleep(timeInterval);
      }

    } catch (InterruptedException e) {
View Full Code Here

Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

        ConfigKeys.TOPIC_SIME, "SampleSimpleTopic");
    String consumerLocation = configurations.getProperty(
        ConfigKeys.CONSUMER_EPR,
        "http://localhost:2222/axis2/services/ConsumerService");

    WseMsgBrokerClient client = new WseMsgBrokerClient();
    client.init(brokerLocation);
    // create a topic subscription.
    String subscriptionId = client.subscribe(consumerLocation,
        topicExpression, null);

    System.out.println("subscription id : " + subscriptionId);
  }
View Full Code Here

Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

        }

        Thread.sleep(5000);

        WseMsgBrokerClient client = new WseMsgBrokerClient();
        client.init(BROKER_URL);

        for (int j = 0; j < NUMBER_OF_SUBSCRIBERS; j++) {
            for (int i = 0; i < NOTIFICATIONS_PUBLISHED; i++) {

                client.publish("topic" + j, CommonUtils.WORKFLOW_INITIALIZED_NOTIFICATION);

                Thread.sleep(100);
            }
        }
View Full Code Here

Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

                .createMessageBoxSubscription(MESSAGEBOX_URL, BROKER_URL, TOPIC, null, this, false);

        brokerPublishEPR = sub.getBrokerURL();
        System.out.println(brokerPublishEPR);

        WseMsgBrokerClient client = new WseMsgBrokerClient();
        client.init(brokerPublishEPR);

        OMElement msg = OMAbstractFactory.getOMFactory().createOMElement("testMessage", null);
        msg.setText("some message");
        client.publish(TOPIC, msg);

        Thread.sleep(10000);
        for (int i = 0; i < messages; ++i) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            try {
                sub = LeadNotificationManager.renewMessageboxSubscription(BROKER_URL, sub.getMessageBoxEPR(),
                        sub.getSubscriptionID(), TOPIC, null, false);
            } catch (AxisFault e) {
                e.printStackTrace();
            }
        }

        Thread.sleep(10000);

        for (int i = 0; i < messages; ++i) {
            client.publish(TOPIC, msg);

            Thread.sleep(100);

        }
View Full Code Here

Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

                sub.destroy();
            } catch (RemoteException e1) {
                e1.printStackTrace();
            }
            System.out.println("Destroyed");
            WseMsgBrokerClient client = new WseMsgBrokerClient();
            client.init(BROKER_URL);
            try {
                client.publish(TOPIC, "some message");
            } catch (MsgBrokerClientException e) {
                e.printStackTrace();
            }
        }
View Full Code Here

Examples of org.apache.airavata.wsmg.client.WseMsgBrokerClient

    String[] consumerEprs = null;

    String subscriptionId = null;

    WseMsgBrokerClient client = new WseMsgBrokerClient();
    client.init(brokerLocation);
    try {
      consumerEprs = client.startConsumerService(consumerPort,
          msgReciever);

    } catch (MsgBrokerClientException e) {

      e.printStackTrace();

      System.out.println("unable to start consumer service, exiting");
      return;
    }

    try {

      subscriptionId = client.subscribe(consumerEprs[0], null,
          xpathExpression);
      System.out.println(getName() + "got the subscription id :"
          + subscriptionId);

    } catch (MsgBrokerClientException e) {

      e.printStackTrace();

      System.out
          .println("unable to subscribe for the xpath consumer exiting");
      return;
    }

    try {

      do {

        SOAPEnvelope env = msgReciever.getQueue().take();

        String msg;
        try {
          msg = env.getBody().getFirstElement().toStringWithConsume();
          System.out.println(String.format(
              "consumer [%s] recieved: %s", getName(), msg));

        } catch (Exception e) {
          System.err.print("invalid msg recieved");
        }

      } while (true);

    } catch (InterruptedException ie) {

      try {
        // unsubscribe from the topic.
        client.unSubscribe(subscriptionId);
       
      } catch (MsgBrokerClientException e) {

        e.printStackTrace();
        System.out.println("unable to unsubscribe, ignoring");
      }

      // shutdown the consumer service.
      client.shutdownConsumerService();

      System.out.println("interrupted");

    }
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.