private void addStoreRememberTx(StoreAndRememberContext cxt, String storeVerifyTxUID) { for (String sopInstanceUID : cxt.getInstances()) { StoreAndRemember sr = new StoreAndRemember(); sr.setTransactionUID(cxt.getTransactionUID()); sr.setStoreVerifyTransactionUID(storeVerifyTxUID); sr.setStatus(StoreAndRememberStatus.PENDING); sr.setLocalAE(cxt.getLocalAE()); sr.setRemoteAE(cxt.getRemoteAE()); sr.setExternalDeviceName(cxt.getExternalDeviceName()); sr.setStoreVerifyProtocol(cxt.getStoreVerifyProtocol().toString()); sr.setRetriesLeft(cxt.getRetries()); sr.setDelay(cxt.getDelay()); sr.setSopInstanceUID(sopInstanceUID); sr.setInstanceStatus(StoreVerifyStatus.PENDING); em.persist(sr); } }
public void scheduleStoreAndRemember(StoreAndRememberContext ctx) { try { Connection conn = connFactory.createConnection(); try { Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(storeAndRememberQueue); ObjectMessage msg = session.createObjectMessage(ctx); long delay = ctx.getDelay(); if (delay > 0) { msg.setLongProperty("_HQ_SCHED_DELIVERY", System.currentTimeMillis() + delay); } producer.send(msg); } finally { conn.close(); } } catch (JMSException e) { throw new RuntimeException("Error while scheduling archiving JMS message", e); } }
public void createOrUpdateStoreRememberTx(StoreAndRememberContext cxt, String storeVerifyTxUID) { if (!updateStoreVerifyUIDOfStoreRemembers(cxt.getTransactionUID(), storeVerifyTxUID)) { addStoreRememberTx(cxt, storeVerifyTxUID); } }