Package org.apache.airavata.wsmg.client

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


            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }

        client = new WsntMsgBrokerClient();

    }
View Full Code Here


        .getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);

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

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

    try {

      long count = 0;
      while (true) {
        UUID uuid = UUID.randomUUID();
        count++;
        OMElement omMsg = MsgUtil.createMsg(count, getName(), uuid
            .toString());
        //MsgUtil.print("seding msg", omMsg);
        client.publish(topicExpression, omMsg);

        TimeUnit.SECONDS
            .sleep(getRandomSleepTime(timeIntervalUpperLimit));
      }
View Full Code Here

        try {
            long value = System.currentTimeMillis();
            String msg = String.format("<msg> current time is : %d </msg>", value);

            WsntMsgBrokerClient wsntMsgBrokerClient = new WsntMsgBrokerClient();

            int consumerPort = 6767;

            String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/NotificationService";
            wsntMsgBrokerClient.init(brokerEPR);
            String[] consumerEPRs = wsntMsgBrokerClient.startConsumerService(consumerPort, this);

            assertTrue(consumerEPRs.length > 0);

            String topic = "/WsntRoundTripTestTopic";

            String topicSubscriptionID = wsntMsgBrokerClient.subscribe(consumerEPRs[0], topic, null);
            System.out.println("topic subscription id: " + topicSubscriptionID);

            try {
                wsntMsgBrokerClient.publish(topic, msg);
                wsntMsgBrokerClient.publish(topic, AXIOMUtil.stringToOM("<foo><bar>Test</bar></foo>"));
            } catch (Exception e) {
                fail(e.getMessage());
            }

            Thread.sleep(2000);

            try {
                wsntMsgBrokerClient.unSubscribe(topicSubscriptionID);
            } catch (AxisFault e) {
                e.printStackTrace();
                fail(e.getMessage());
            }

            wsntMsgBrokerClient.shutdownConsumerService();

        } catch (AxisFault e) {
            e.printStackTrace();
            try {
                System.in.read();
View Full Code Here

TOP

Related Classes of org.apache.airavata.wsmg.client.WsntMsgBrokerClient

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.