public void scheduleIAN(
      final String localAET,
      final String remoteAET,
      final Attributes ian,
      final int retries,
      int delay) {
    try {
      jmsService.sendMessage(
          queue,
          new JMSService.MessageCreator() {

            @Override
            public Message createMessage(Session session) throws JMSException {
              ObjectMessage msg = session.createObjectMessage(ian);
              msg.setStringProperty("LocalAET", localAET);
              msg.setStringProperty("RemoteAET", remoteAET);
              msg.setIntProperty("Retries", retries);
              return msg;
            }
          },
          delay);
    } catch (JMSException e) {
      LOG.error("Failed to schedule IAN to " + remoteAET, e);
    }
  }
  public void scheduleForwardMPPS(
      final String localAET,
      final String remoteAET,
      final String iuid,
      final Attributes rqAttrs,
      final boolean ncreate,
      final int retries,
      int delay) {
    try {
      jmsService.sendMessage(
          queue,
          new JMSService.MessageCreator() {

            @Override
            public Message createMessage(Session session) throws JMSException {
              ObjectMessage msg = session.createObjectMessage(rqAttrs);
              msg.setStringProperty("LocalAET", localAET);
              msg.setStringProperty("RemoteAET", remoteAET);
              msg.setStringProperty("SOPInstancesUID", iuid);
              msg.setBooleanProperty("N_CREATE_RQ", ncreate);
              msg.setIntProperty("Retries", retries);
              return msg;
            }
          },
          delay);
    } catch (JMSException e) {
      LOG.error("Failed to schedule forward MPPS to " + remoteAET, e);
    }
  }
 @Override
 public void stop() {
   super.stop();
   jmsService.stop();
   mppsSCU.stop();
   ianSCU.stop();
   stgCmtSCP.stop();
 }
 @Override
 public void start() throws Exception {
   super.start();
   mppsSCU.start(device);
   ianSCU.start(device);
   stgCmtSCP.start(device);
   jmsService.start();
 }
 public void stop() {
   try {
     jmsService.removeMessageListener(this);
   } catch (JMSException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
 public void start(ArchiveDevice device) throws JMSException {
   this.device = device;
   jmsService.addMessageListener(queue, this);
 }