Search in sources :

Example 1 with Event

use of org.apache.airavata.xbaya.messaging.event.Event in project airavata by apache.

the class Monitor method unsubscribe.

/**
 * Unsubcribe from the ws messager client
 * @throws MonitorException
 */
public void unsubscribe(String experimentId) {
    // Enable/disable some menu items.
    sendSafeEvent(new Event(Event.Type.MONITOR_STOPED));
    String id = expIdToSubscribers.remove(experimentId);
    if (id != null) {
        try {
            messageClient.stopListen(id);
        } catch (AiravataException e) {
            logger.warn("Failed to find the subscriber for experiment id: " + id, e);
        }
    }
    setMonitoring(false);
}
Also used : Event(org.apache.airavata.xbaya.messaging.event.Event) AiravataException(org.apache.airavata.common.exception.AiravataException)

Example 2 with Event

use of org.apache.airavata.xbaya.messaging.event.Event in project airavata by apache.

the class Monitor method start.

/**
 * @throws MonitorException
 */
public synchronized void start() throws MonitorException {
    // Make sure currently we are not doing any monitoring
    stop();
    // Reset monitoring variables
    monitoringCompleted = false;
    monitoringFailed = false;
    // Notify listeners that the monitoring is about to start
    getEventDataRepository().triggerListenerForPreMonitorStart();
    try {
        // AiravataUtils.setExecutionAsServer();
        this.messageClient = new RabbitMQStatusConsumer("amqp://localhost:5672", "airavata_rabbitmq_exchange");
    } catch (AiravataException e) {
        String msg = "Failed to start the consumer";
        logger.error(msg, e);
        throw new MonitorException(msg, e);
    }
    // Enable/disable some menu items and show the monitor panel.
    sendSafeEvent(new Event(Event.Type.MONITOR_STARTED));
    getEventDataRepository().triggerListenerForPostMonitorStart();
}
Also used : Event(org.apache.airavata.xbaya.messaging.event.Event) RabbitMQStatusConsumer(org.apache.airavata.messaging.core.impl.RabbitMQStatusConsumer) AiravataException(org.apache.airavata.common.exception.AiravataException)

Aggregations

AiravataException (org.apache.airavata.common.exception.AiravataException)2 Event (org.apache.airavata.xbaya.messaging.event.Event)2 RabbitMQStatusConsumer (org.apache.airavata.messaging.core.impl.RabbitMQStatusConsumer)1