private PauseBean getPauseBean(String submissionQueueName) {

    IQueueReader<PauseBean> qr = null;
    try {
      qr = eservice.createQueueReader(getUri(), EventConstants.CMD_SET);
      qr.setBeanClass(PauseBean.class);
      List<PauseBean> pausedList = qr.getQueue();

      // The most recent bean in the queue is the latest
      for (PauseBean pauseBean : pausedList) {
        if (submissionQueueName.equals(pauseBean.getQueueName())) return pauseBean;
      }

    } catch (Exception ne) {
      logger.error("Cannot get queue " + EventConstants.CMD_SET, ne);
      return null;

    } finally {
      try {
        if (qr != null) qr.disconnect();
      } catch (EventException e) {
        logger.error("Cannot get disconnect " + EventConstants.CMD_SET, e);
      }
    }
    return null;
  }
  protected void togglePausedConsumer(IAction pauseConsumer) {

    // The button can get out of sync if two clients are used.
    final boolean currentState = queueConnection.isQueuePaused(getSubmissionQueueName());
    try {
      pauseConsumer.setChecked(!currentState); // We are toggling it.

      IPublisher<PauseBean> pauser = service.createPublisher(getUri(), IEventService.CMD_TOPIC);
      pauser.setStatusSetName(IEventService.CMD_SET); // The set that other clients may check
      pauser.setStatusSetAddRequired(true);

      PauseBean pbean = new PauseBean();
      pbean.setQueueName(getSubmissionQueueName()); // The queue we are pausing
      pbean.setPause(pauseConsumer.isChecked());
      pauser.broadcast(pbean);

    } catch (Exception e) {
      ErrorDialog.openError(
          getViewSite().getShell(),
          "Cannot pause queue " + getSubmissionQueueName(),
          "Cannot pause queue "
              + getSubmissionQueueName()
              + "\n\nPlease contact your support representative.",
          new Status(IStatus.ERROR, "org.eclipse.scanning.event.ui", e.getMessage()));
    }
    pauseConsumer.setChecked(queueConnection.isQueuePaused(getSubmissionQueueName()));
  }
  protected void processPause(PauseBean bean) {
    try {
      if (bean.isPause()) {
        pause();
      } else {
        resume();
      }

    } catch (Exception ne) {
      ne.printStackTrace();
      logger.error(
          "Unable to process pause command on consumer '" + getName() + "'. Consumer will stop.",
          ne);
      try {
        stop();
        disconnect();
      } catch (EventException e) {
        logger.error(
            "An internal error occurred trying to terminate the consumer "
                + getName()
                + " "
                + getConsumerId());
      }
    }
  }