public class MessageSizeProducerSessionFactory extends ProducerSessionFactoryImpl
ProducerSessionFactory
that creates a new session/producer based on message size.
This implementaton refreshes the session based on the total size of the messages produced.
In the adapter configuration file this class is aliased as jms-message-size-producer-session which is the preferred alternative to the fully qualified classname when building your configuration.
log, session
Constructor and Description |
---|
MessageSizeProducerSessionFactory() |
MessageSizeProducerSessionFactory(java.lang.Long max) |
Modifier and Type | Method and Description |
---|---|
ProducerSession |
createProducerSession(JmsProducerImpl producer,
AdaptrisMessage msg)
Create or reuse an existing session.
|
java.lang.Long |
getMaxSizeBytes() |
void |
init()
Initialises the component.
|
void |
setMaxSizeBytes(java.lang.Long max)
Set the maximum accumulated size of messages before a session refresh is required.
|
close, closeQuietly, createProducerSession, start, stop
public MessageSizeProducerSessionFactory()
public MessageSizeProducerSessionFactory(java.lang.Long max)
public 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 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 java.lang.Long getMaxSizeBytes()
public void setMaxSizeBytes(java.lang.Long max)
max
- the max size of messages; if not specified, defaults to 10 megabytes.