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.Type
MailQueue.MailQueueException, MailQueue.MailQueueItem
connectionFactory, FORCE_DELIVERY, logger, queuename
JAMES_BLOB_URL, JAMES_QUEUE_NAME, JAMES_REUSE_BLOB_URL
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
HIGH_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, toString
public ActiveMQMailQueue(javax.jms.ConnectionFactory connectionFactory, String queuename, org.slf4j.Logger logger)
ActiveMQMailQueue
which only use BlobMessage
NotCompliantMBeanException
ActiveMQMailQueue(ConnectionFactory, String, boolean, Logger)
protected void populateMailMimeMessage(javax.jms.Message message, org.apache.mailet.Mail mail) throws javax.mail.MessagingException, javax.jms.JMSException
JMSMailQueue
Mail
instance with a MimeMessage
. The
MimeMessage
is read from the JMS Message. This implementation use
a BytesMessage
populateMailMimeMessage
in class JMSMailQueue
javax.mail.MessagingException
javax.jms.JMSException
JMSMailQueue.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 JMSMailQueue
javax.jms.JMSException
javax.mail.MessagingException
IOException
protected org.apache.activemq.ActiveMQSession getAMQSession(javax.jms.Session session) throws javax.jms.JMSException
Session
to an ActiveMQSession
session
- javax.jms.JMSException
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
JMSMailQueue
MailQueue.MailQueueItem
for the given parameterscreateMailQueueItem
in class JMSMailQueue
javax.jms.JMSException
javax.mail.MessagingException
public List<javax.jms.Message> removeWithSelector(String selector) throws MailQueue.MailQueueException
JMSMailQueue
removeWithSelector
in class JMSMailQueue
MailQueue.MailQueueException
protected javax.jms.Message copy(javax.jms.Session session, javax.jms.Message m) throws javax.jms.JMSException
JMSMailQueue
Message
. This includes the properties
and the payloadcopy
in class JMSMailQueue
javax.jms.JMSException
public long getSize() throws MailQueue.MailQueueException
JMSMailQueue.getSize()
getSize
in interface ManageableMailQueue
getSize
in class JMSMailQueue
MailQueue.MailQueueException
ManageableMailQueue.getSize()
Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.