use of org.eclipse.scanning.api.event.IEventService in project gda-core by openGDA.
the class StandardsScanView method createView.
@PostConstruct
public void createView(Composite parent) {
GridDataFactory.swtDefaults().applyTo(parent);
GridLayoutFactory.swtDefaults().applyTo(parent);
createScannableEditor(parent);
createSubmitSection(parent);
final IEventService eventService = injectionContext.get(IEventService.class);
try {
final URI activeMQUri = new URI(LocalProperties.getActiveMQBrokerURI());
jobQueueProxy = eventService.createJobQueueProxy(activeMQUri, EventConstants.SUBMISSION_QUEUE, EventConstants.CMD_TOPIC, EventConstants.ACK_TOPIC);
} catch (Exception e) {
logger.error("Error creating job queue proxy", e);
}
}
use of org.eclipse.scanning.api.event.IEventService in project gda-core by openGDA.
the class ApplicationActionBarAdvisor method buildScanStatus.
private StatusLineContributionItem buildScanStatus() {
StatusLineContributionItem scanStatus = new StatusLineContributionItem("GDA-ScanStatus", true, 55);
IEventService service = ServiceHolder.getEventService();
try {
ISubscriber<IBeanListener<StatusBean>> statusTopicSubscriber = service.createSubscriber(getActiveMqUri(), EventConstants.STATUS_TOPIC);
statusTopicSubscriber.addListener(event -> {
if (event.getBean() instanceof ScanBean) {
updateScanDetails(scanStatus, (ScanBean) event.getBean());
}
});
ApplicationWorkbenchAdvisor.addCleanupWork(() -> {
try {
statusTopicSubscriber.removeAllListeners();
statusTopicSubscriber.close();
} catch (EventException e1) {
logger.error("Error removing listener from STATUS_TOPIC", e1);
}
});
} catch (NullPointerException e) {
// Handling for non-StatusQueueView/Mapping beamlines, prevent stack trace being printed to console
if (service == null) {
logger.warn("EventService null when adding listener to STATUS_TOPIC, ScanBean status bar progress disabled. If this beamline uses the Queue, this will cause errors elsewhere");
} else {
throw e;
}
} catch (Exception e2) {
logger.error("Error adding listener to STATUS_TOPIC", e2);
}
return scanStatus;
}
use of org.eclipse.scanning.api.event.IEventService in project gda-core by openGDA.
the class NodeFileRequesterService method createNodeFileRequester.
private void createNodeFileRequester() throws EventException {
try {
URI activemqURL = new URI(LocalProperties.getActiveMQBrokerURI());
IEventService eventService = Activator.getService(IEventService.class);
nodeFileRequester = eventService.createRequestor(activemqURL, requestTopic, responseTopic);
nodeFileRequester.setTimeout(5, TimeUnit.SECONDS);
} catch (URISyntaxException e) {
throw new EventException("Cannot create submitter", e);
}
}
use of org.eclipse.scanning.api.event.IEventService 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);
}
}
use of org.eclipse.scanning.api.event.IEventService in project gda-core by openGDA.
the class ProcessingSelectionWizardPage method getRunnableDeviceService.
private IRunnableDeviceService getRunnableDeviceService() throws EventException, URISyntaxException {
if (runnableDeviceService == null) {
IEventService eventService = context.get(IEventService.class);
URI jmsURI = new URI(LocalProperties.getActiveMQBrokerURI());
runnableDeviceService = eventService.createRemoteService(jmsURI, IRunnableDeviceService.class);
}
return runnableDeviceService;
}
Aggregations