public class MessageCountProducerSessionFactory extends ProducerSessionFactoryImpl
ProducerSessionFactory
that creates a new session/producer based the number of messages.
This implementaton refreshes the session based on a count of the number of messages.
In the adapter configuration file this class is aliased as jms-message-count-producer-session which is the preferred alternative to the fully qualified classname when building your configuration.
log, session
Constructor and Description |
---|
MessageCountProducerSessionFactory() |
MessageCountProducerSessionFactory(java.lang.Integer max) |
Modifier and Type | Method and Description |
---|---|
ProducerSession |
createProducerSession(JmsProducerImpl producer,
AdaptrisMessage msg)
Create or reuse an existing session.
|
java.lang.Integer |
getMaxMessages() |
void |
init()
Initialises the component.
|
void |
setMaxMessages(java.lang.Integer max)
Set the maximum number of messages before a session refresh is required.
|
close, closeQuietly, createProducerSession
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
start, stop
public MessageCountProducerSessionFactory()
public MessageCountProducerSessionFactory(java.lang.Integer max)
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
init
in class ProducerSessionFactoryImpl
CoreException
- wrapping any underlying Exception
spublic ProducerSession createProducerSession(JmsProducerImpl producer, AdaptrisMessage msg) throws javax.jms.JMSException
ProducerSessionFactory
producer
- the JmsProducerImpl
instancemsg
- the message that the producer is currently handling.ProducerSession
javax.jms.JMSException
- if there was a problem creating the session.public java.lang.Integer getMaxMessages()
public void setMaxMessages(java.lang.Integer max)
max
- the max number of messages; if not specified, defaults to 1024.