Package org.apache.airavata.wsmg.client

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


            System.out.println("unable to load configuration file, "
                    + "default settings will be used");
        }

        WseMsgBrokerClient brokerClient = new WseMsgBrokerClient();
        String brokerLocation = configurations.getProperty(ConfigKeys.MSGBROKER_SERVICE_URL);
        brokerClient.init(brokerLocation);
        String topic = configurations.getProperty(ConfigKeys.TOPIC);
        NotificationSender sender = new NotificationSender(brokerLocation, topic);
        // Creating a messagebox
        EndpointReference msgBoxEpr = brokerClient.createPullMsgBox(configurations.getProperty(ConfigKeys.MSGBOX_SERVICE_URL));

        // subscribing to the above created messsage box with configured topic
        String subscriptionID = brokerClient.subscribe(msgBoxEpr.getAddress(), topic, null);


        //Start the messagePuller to pull messages from newly created messagebox
        MessagePuller puller = brokerClient.startPullingEventsFromMsgBox(msgBoxEpr, new Listener(), 1000L, 2000L);

        sender.workflowStarted("Workflow Started");
        //Here we simply assume the workflow invocation is the invoke of the subscribe operation of EventingService and result
        // Is considered as the subscriptionID got from subscribe operation
        String workflowResult = subscriptionID;
        sender.workflowFinished(workflowResult);

        try {
            Thread.sleep(10000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        brokerClient.unSubscribe(subscriptionID);
        puller.stopPulling();
        System.out.println("Delete message box response :  "
                + brokerClient.deleteMsgBox(msgBoxEpr, 500L));

    }
View Full Code Here


     * @param callback
     * @return
     * @throws Exception
     */
    public Subscription createSubscription() throws Exception {
        WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
        wseClient.init(brokerLoc);
        logger.debug("Starting Subscription for topic [" + topic + "]at the broker location:" + brokerLoc);
        ConsumerServer xs = new ConsumerServer(consumerServerPort, this);
        xs.start();
        String subscriptionId = wseClient.subscribe(xs.getConsumerServiceEPRs()[0], topic, null);
        logger.info("The consumer server started on EPR" + xs.getConsumerServiceEPRs()[0]);
        Subscription subscription = new Subscription(xs, subscriptionId, topic, callback, brokerLoc);
        return subscription;
    }
View Full Code Here

        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

            if (logger.isDebugEnabled())
                logger.info("\n\nStopping the Messagebox for topic" + this.topic);
        }

        try {
            WseMsgBrokerClient client = new WseMsgBrokerClient();
            client.init(this.brokerURL.toString());
            client.unSubscribe(this.subscriptionId);

            MsgboxHandler msgboxHandler = new MsgboxHandler();

            logger.info("Unsubscribing the messagebox that was destroyed," + " SubscriptionID:" + this.subscriptionId);
View Full Code Here

    public Subscription renewMessageboxSubscription(String epr, String subscriptionId, String topic, String xpath,
            boolean subscribePermanatly) throws MsgBrokerClientException {

        this.subscriptionId = subscriptionId;
        this.topic = topic;
        WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
        EndpointReference endpointReference = null;
        try {
            endpointReference = EndpointReferenceHelper.fromString(epr);
        } catch (AxisFault f) {
            throw new MsgBrokerClientException("unable to convert end point reference", f);
View Full Code Here

    public Subscription renewMessageboxSubscription(EndpointReference endpointReference, String subscriptionId,
            String topic, String xpath, boolean subscribePermanatly) throws MsgBrokerClientException {

        this.subscriptionId = subscriptionId;
        this.topic = topic;
        WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
        logger.info("\n\nCreate Subscription for topic" + topic + " [Messagebox]\n\n");

        subscriptionId = subscribeToBroker(endpointReference.getAddress(), topic, xpath, wseClient, subscribePermanatly);
        Subscription subscription = new Subscription(this, subscriptionId, topic, callback, this.brokerURL);
        subscription.setMessageBoxEpr(endpointReference);
View Full Code Here

    public Subscription startListeningToPreviousMessageBox(EndpointReference msgBoxAddr, String subscriptionId,
            String topic, String xpath, Callback callback, boolean subscribePermanatly) throws MsgBrokerClientException {
        this.callback = callback;
        this.subscriptionId = subscriptionId;
        this.topic = topic;
        WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
        MsgboxHandler msgboxHandler = new MsgboxHandler();

        messagePuller = msgboxHandler.startPullingFromExistingMsgBox(msgBoxAddr, this, 500L, 1000L);
        if (logger.isDebugEnabled())
            logger.info("\n\nCreate Subscription for topic" + topic + " [Messagebox]\n\n");
View Full Code Here

    public Subscription createSubscription(String topic, String xpath, Callback callback, boolean subscribePermananly)
            throws Exception {
        this.topic = topic;
        this.callback = callback;

        WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
        MsgboxHandler msgboxHandler = new MsgboxHandler();
        EndpointReference msgBoxAddr = msgboxHandler.createPullMsgBox(this.messageBoxUrl, 1000l);

        String messageBoxAddress = msgBoxAddr.getAddress();
        if (logger.isDebugEnabled())
View Full Code Here

            boolean subscribePermanatly) throws MsgBrokerClientException {

        this.topic = topic2;
        this.callback = callback2;

        WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
        MsgboxHandler msgboxHandler = new MsgboxHandler();
        EndpointReference msgBoxAddr = msgboxHandler.createPullMsgBox(this.messageBoxUrl, 1000l);
        if (logger.isDebugEnabled())
            logger.info("\n\nCreated Messagebox at address :" + msgBoxAddr.getAddress());
View Full Code Here

            if (logger.isDebugEnabled())
                logger.info("\n\nStopping the Messagebox for topic" + this.topic);
        }

        try {
            WseMsgBrokerClient client = new WseMsgBrokerClient();
            client.init(this.brokerURL.toString());
            client.unSubscribe(this.subscriptionId);

            MsgboxHandler msgboxHandler = new MsgboxHandler();

            logger.info("Unsubscribing the messagebox that was destroyed," + " SubscriptionID:" + this.subscriptionId);
View Full Code Here

TOP

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

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.