public class ActiveMQMailQueue extends JMSMailQueue implements ActiveMQSupport
MailQueue implementation which use an ActiveMQ Queue.
This implementation require at ActiveMQ 5.4.0+.
When a
Mail attribute is found and is not one of the supported
primitives, then the toString() method is called on the attribute value to
convert it
The implementation use
BlobMessage or ObjectMessage,
depending on the constructor which was used
See http://activemq.apache .org/blob-messages.html for more details
Some other supported feature is handling of priorities. See:
For this just add a
Mail attribute with name MailPrioritySupport.MAIL_PRIORITY
to it. It should use one of the following value MailPrioritySupport.LOW_PRIORITY,
MailPrioritySupport.NORMAL_PRIORITY, MailPrioritySupport.HIGH_PRIORITY
To have a good throughput you should use a caching connection factory.
ManageableMailQueue.MailQueueItemView, ManageableMailQueue.MailQueueIterator, ManageableMailQueue.TypeMailQueue.MailQueueException, MailQueue.MailQueueItemconnectionFactory, FORCE_DELIVERY, logger, queuenameJAMES_BLOB_URL, JAMES_QUEUE_NAME, JAMES_REUSE_BLOB_URLJAMES_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_DELIVERYHIGH_PRIORITY, LOW_PRIORITY, MAIL_PRIORITY, NORMAL_PRIORITY| Constructor and Description |
|---|
ActiveMQMailQueue(javax.jms.ConnectionFactory connectionFactory,
String queuename,
boolean useBlob,
org.slf4j.Logger logger)
Construct a new ActiveMQ based
MailQueue. |
ActiveMQMailQueue(javax.jms.ConnectionFactory connectionFactory,
String queuename,
org.slf4j.Logger logger)
Construct a
ActiveMQMailQueue which only use BlobMessage |
| Modifier and Type | Method and Description |
|---|---|
protected javax.jms.Message |
copy(javax.jms.Session session,
javax.jms.Message m)
Create a copy of the given
Message. |
protected MailQueue.MailQueueItem |
createMailQueueItem(javax.jms.Connection connection,
javax.jms.Session session,
javax.jms.MessageConsumer consumer,
javax.jms.Message message)
Create a
MailQueue.MailQueueItem for the given parameters |
protected org.apache.activemq.ActiveMQSession |
getAMQSession(javax.jms.Session session)
Cast the given
Session to an ActiveMQSession |
long |
getSize()
Try to use ActiveMQ StatisticsPlugin to get size and if that fails
fallback to
JMSMailQueue.getSize() |
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
|
List<javax.jms.Message> |
removeWithSelector(String selector)
Remove messages with the given selector
|
browse, clear, convertAttributeValue, count, createMail, deQueue, enQueue, enQueue, flush, getJMSProperties, getMessageSelector, populateMail, remove, toStringpublic ActiveMQMailQueue(javax.jms.ConnectionFactory connectionFactory,
String queuename,
org.slf4j.Logger logger)
ActiveMQMailQueue which only use BlobMessageNotCompliantMBeanExceptionActiveMQMailQueue(ConnectionFactory, String, boolean, Logger)protected void populateMailMimeMessage(javax.jms.Message message,
org.apache.mailet.Mail mail)
throws javax.mail.MessagingException,
javax.jms.JMSException
JMSMailQueueMail instance with a MimeMessage. The
MimeMessage is read from the JMS Message. This implementation use
a BytesMessagepopulateMailMimeMessage in class JMSMailQueuejavax.mail.MessagingExceptionjavax.jms.JMSExceptionJMSMailQueue.populateMailMimeMessage(javax.jms.Message, org.apache.mailet.Mail)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
produceMail in class JMSMailQueuejavax.jms.JMSExceptionjavax.mail.MessagingExceptionIOExceptionprotected org.apache.activemq.ActiveMQSession getAMQSession(javax.jms.Session session)
throws javax.jms.JMSException
Session to an ActiveMQSessionsession - javax.jms.JMSExceptionprotected 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
JMSMailQueueMailQueue.MailQueueItem for the given parameterscreateMailQueueItem in class JMSMailQueuejavax.jms.JMSExceptionjavax.mail.MessagingExceptionpublic List<javax.jms.Message> removeWithSelector(String selector) throws MailQueue.MailQueueException
JMSMailQueueremoveWithSelector in class JMSMailQueueMailQueue.MailQueueExceptionprotected javax.jms.Message copy(javax.jms.Session session,
javax.jms.Message m)
throws javax.jms.JMSException
JMSMailQueueMessage. This includes the properties
and the payloadcopy in class JMSMailQueuejavax.jms.JMSExceptionpublic long getSize()
throws MailQueue.MailQueueException
JMSMailQueue.getSize()getSize in interface ManageableMailQueuegetSize in class JMSMailQueueMailQueue.MailQueueExceptionManageableMailQueue.getSize()Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.