|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.james.queue.jms.JMSMailQueue
public class JMSMailQueue
MailQueue implementation which use a JMS Queue for the
MailQueue. This implementation should work with every JMS 1.1.0
implementation
It use ObjectMessage with a byte array as payload to store the
Mail objects.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.apache.james.queue.api.ManageableMailQueue |
|---|
ManageableMailQueue.MailQueueItemView, ManageableMailQueue.MailQueueIterator, ManageableMailQueue.Type |
| Nested classes/interfaces inherited from interface org.apache.james.queue.api.MailQueue |
|---|
MailQueue.MailQueueException, MailQueue.MailQueueItem |
| Field Summary | |
|---|---|
protected javax.jms.ConnectionFactory |
connectionFactory
|
static String |
FORCE_DELIVERY
|
protected org.slf4j.Logger |
logger
|
protected String |
queuename
|
| Fields inherited from interface org.apache.james.queue.api.MailQueue |
|---|
NO_DELAY |
| Fields inherited from interface org.apache.james.queue.jms.JMSSupport |
|---|
JAMES_MAIL_ATTRIBUTE_NAMES, JAMES_MAIL_ERROR_MESSAGE, JAMES_MAIL_LAST_UPDATED, JAMES_MAIL_MESSAGE_SIZE, JAMES_MAIL_NAME, JAMES_MAIL_RECIPIENTS, JAMES_MAIL_REMOTEADDR, JAMES_MAIL_REMOTEHOST, JAMES_MAIL_SENDER, JAMES_MAIL_SEPARATOR, JAMES_MAIL_STATE, JAMES_NEXT_DELIVERY |
| Fields inherited from interface org.apache.james.queue.api.MailPrioritySupport |
|---|
HIGH_PRIORITY, LOW_PRIORITY, MAIL_PRIORITY, NORMAL_PRIORITY |
| Constructor Summary | |
|---|---|
JMSMailQueue(javax.jms.ConnectionFactory connectionFactory,
String queuename,
org.slf4j.Logger logger)
|
|
| Method Summary | |
|---|---|
ManageableMailQueue.MailQueueIterator |
browse()
|
long |
clear()
|
protected Object |
convertAttributeValue(Object value)
Convert the attribute value if necessary. |
protected javax.jms.Message |
copy(javax.jms.Session session,
javax.jms.Message m)
Create a copy of the given Message. |
protected long |
count(List<javax.jms.Message> msgs)
|
protected org.apache.mailet.Mail |
createMail(javax.jms.Message message)
Create the complete Mail from the JMS Message. |
protected MailQueue.MailQueueItem |
createMailQueueItem(javax.jms.Connection connection,
javax.jms.Session session,
javax.jms.MessageConsumer consumer,
javax.jms.Message message)
Create a MailQueueItem for the given parameters |
MailQueue.MailQueueItem |
deQueue()
Execute the given DequeueOperation when a mail is ready to
process. |
void |
enQueue(org.apache.mailet.Mail mail)
|
void |
enQueue(org.apache.mailet.Mail mail,
long delay,
TimeUnit unit)
|
long |
flush()
|
protected Map<String,Object> |
getJMSProperties(org.apache.mailet.Mail mail,
long delayInMillis)
Get JMS Message properties with values |
protected String |
getMessageSelector()
|
long |
getSize()
|
protected void |
populateMail(javax.jms.Message message,
MailImpl mail)
Populate Mail with values from Message. |
protected void |
populateMailMimeMessage(javax.jms.Message message,
org.apache.mailet.Mail mail)
Populat the given Mail instance with a MimeMessage. |
protected void |
produceMail(javax.jms.Session session,
Map<String,Object> props,
int msgPrio,
org.apache.mailet.Mail mail)
Produce the mail to the JMS Queue |
long |
remove(ManageableMailQueue.Type type,
String value)
|
List<javax.jms.Message> |
removeWithSelector(String selector)
Remove messages with the given selector |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final String queuename
protected final javax.jms.ConnectionFactory connectionFactory
protected final org.slf4j.Logger logger
public static final String FORCE_DELIVERY
| Constructor Detail |
|---|
public JMSMailQueue(javax.jms.ConnectionFactory connectionFactory,
String queuename,
org.slf4j.Logger logger)
| Method Detail |
|---|
public MailQueue.MailQueueItem deQueue()
throws MailQueue.MailQueueException
Execute the given DequeueOperation when a mail is ready to
process. As JMS does not support delay scheduling out-of-the box, we use
a messageselector to check if a mail is ready. For this a
{@link MessageConsumer#receive(long) is used with a timeout of 10
seconds.
Many JMS implementations support better solutions for this, so this should get overridden by these implementations
deQueue in interface MailQueueMailQueue.MailQueueException
public void enQueue(org.apache.mailet.Mail mail,
long delay,
TimeUnit unit)
throws MailQueue.MailQueueException
enQueue in interface MailQueueMailQueue.MailQueueException
public void enQueue(org.apache.mailet.Mail mail)
throws MailQueue.MailQueueException
enQueue in interface MailQueueMailQueue.MailQueueException
protected void produceMail(javax.jms.Session session,
Map<String,Object> props,
int msgPrio,
org.apache.mailet.Mail mail)
throws javax.jms.JMSException,
javax.mail.MessagingException,
IOException
javax.jms.JMSException
javax.mail.MessagingException
IOException
protected Map<String,Object> getJMSProperties(org.apache.mailet.Mail mail,
long delayInMillis)
throws javax.jms.JMSException,
javax.mail.MessagingException
message - mail - delayInMillis -
javax.jms.JMSException
javax.mail.MessagingException
protected final org.apache.mailet.Mail createMail(javax.jms.Message message)
throws javax.mail.MessagingException,
javax.jms.JMSException
Mail is completly populated
message -
javax.mail.MessagingException
javax.jms.JMSException
protected void populateMailMimeMessage(javax.jms.Message message,
org.apache.mailet.Mail mail)
throws javax.mail.MessagingException,
javax.jms.JMSException
Mail instance with a MimeMessage. The
MimeMessage is read from the JMS Message. This implementation use
a BytesMessage
message - mail -
javax.mail.MessagingException
javax.jms.JMSException
protected void populateMail(javax.jms.Message message,
MailImpl mail)
throws javax.jms.JMSException
MimeMessage
message - mail -
javax.jms.JMSExceptionprotected Object convertAttributeValue(Object value)
value -
public String toString()
toString in class Object
protected MailQueue.MailQueueItem createMailQueueItem(javax.jms.Connection connection,
javax.jms.Session session,
javax.jms.MessageConsumer consumer,
javax.jms.Message message)
throws javax.jms.JMSException,
javax.mail.MessagingException
MailQueueItem for the given parameters
connection - session - consumer - message -
javax.jms.JMSException
javax.mail.MessagingExceptionprotected String getMessageSelector()
public long getSize()
throws MailQueue.MailQueueException
getSize in interface ManageableMailQueueMailQueue.MailQueueException
public long flush()
throws MailQueue.MailQueueException
flush in interface ManageableMailQueueMailQueue.MailQueueException
public long clear()
throws MailQueue.MailQueueException
clear in interface ManageableMailQueueMailQueue.MailQueueExceptionprotected long count(List<javax.jms.Message> msgs)
public List<javax.jms.Message> removeWithSelector(String selector)
throws MailQueue.MailQueueException
selector -
MailQueue.MailQueueException
protected javax.jms.Message copy(javax.jms.Session session,
javax.jms.Message m)
throws javax.jms.JMSException
Message. This includes the properties
and the payload
session - m -
javax.jms.JMSException
public long remove(ManageableMailQueue.Type type,
String value)
throws MailQueue.MailQueueException
remove in interface ManageableMailQueueMailQueue.MailQueueException
public ManageableMailQueue.MailQueueIterator browse()
throws MailQueue.MailQueueException
browse in interface ManageableMailQueueMailQueue.MailQueueException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||