@Override public Mail getMail() { return mailQueueItem.getMail(); }
@Override public void done(boolean success) throws MailQueueException { mailQueueItem.done(success); } }
@Override public MailQueueItemDecorator decorate(MailQueueItem mailQueueItem) { return new RawMailQueueItem(mailQueueItem); }
@Override public void sendMail(Mail mail, String state) throws MessagingException { mail.setAttribute(Mail.SENT_BY_MAILET, "true"); mail.setState(state); rootMailQueue.enQueue(mail); }
@Override public void init(Configuration config) throws ConfigurationException { queue = queueFactory.createQueue(MailQueueFactory.SPOOL); }
@PostConstruct public void init() { queue = queueFactory.getQueue(MailQueueFactory.SPOOL); }
@Override public long removeWithRecipient(String address) throws Exception { try { return queue.remove(Type.Recipient, address); } catch (MailQueueException e) { throw new Exception(e.getMessage()); } }
public static MailProjection from(ManageableMailQueue.MailQueueItemView item) { return from(item.getMail()); }
@Override public long getSize() throws Exception { try { return queue.getSize(); } catch (MailQueueException e) { throw new Exception(e.getMessage()); } }
@Override public long clear() throws Exception { try { return queue.clear(); } catch (MailQueueException e) { throw new Exception(e.getMessage()); } }
@Override public long flush() throws Exception { try { return queue.flush(); } catch (MailQueueException e) { throw new Exception(e.getMessage()); } }
private long getRemainingSize() { try { return queue.getSize(); } catch (MailQueue.MailQueueException e) { throw new RuntimeException(e); } } }
@Override public Result run() { try { queue.clear(); } catch (MailQueue.MailQueueException e) { LOGGER.error("Clear MailQueue got an exception", e); return Result.PARTIAL; } return Result.COMPLETED; }
public ClearMailQueueTask(ManageableMailQueue queue) { this.queue = queue; additionalInformation = new AdditionalInformation(queue.getName(), this::getRemainingSize); }
@Override public void sendMail(Mail mail, String state, long delay, TimeUnit unit) throws MessagingException { mail.setAttribute(Mail.SENT_BY_MAILET, "true"); mail.setState(state); rootMailQueue.enQueue(mail, delay, unit); }
@Inject public void retrieveRootMailQueue(MailQueueFactory<?> mailQueueFactory) { this.rootMailQueue = mailQueueFactory.createQueue(MailQueueFactory.SPOOL); }
@Override public Mail getMail() { return mailQueueItem.getMail(); }
@Override public long removeWithSender(String address) throws Exception { try { return queue.remove(Type.Sender, address); } catch (MailQueueException e) { throw new Exception(e.getMessage()); } }
public long getRemainingSize() { try { return queue.getSize(); } catch (MailQueue.MailQueueException e) { throw new RuntimeException(e); } } }
@Override public long removeWithName(String name) throws Exception { try { return queue.remove(Type.Name, name); } catch (MailQueueException e) { throw new Exception(e.getMessage()); } }