Search in sources :

Example 1 with QueueCommandBean

use of org.eclipse.scanning.api.event.queue.QueueCommandBean in project gda-core by openGDA.

the class QueueAndRunExperimentNewQueueCommandHandler method startQueue.

/**
 * Starts the new GDA9 queue by sending a {@link PauseBean} with
 * <code>pause</code> set to <code>false</code>.
 */
private void startQueue() {
    IEventService eventService = EventServiceHolder.getEventService();
    if (eventService == null) {
        throw new IllegalStateException("Event service not set - should be set by OSGi DS");
    }
    try (IPublisher<QueueCommandBean> publisher = eventService.createPublisher(new URI(LocalProperties.getActiveMQBrokerURI()), EventConstants.CMD_TOPIC)) {
        QueueCommandBean bean = new QueueCommandBean(EventConstants.SUBMISSION_QUEUE, Command.RESUME_QUEUE);
        publisher.broadcast(bean);
    } catch (EventException | URISyntaxException e) {
        logger.error("Cannot pause scan queue", e);
    }
}
Also used : QueueCommandBean(org.eclipse.scanning.api.event.queue.QueueCommandBean) EventException(org.eclipse.scanning.api.event.EventException) IEventService(org.eclipse.scanning.api.event.IEventService) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Aggregations

URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 EventException (org.eclipse.scanning.api.event.EventException)1 IEventService (org.eclipse.scanning.api.event.IEventService)1 QueueCommandBean (org.eclipse.scanning.api.event.queue.QueueCommandBean)1