Package com.adaptris.core.jms
Class MessageSizeProducerSessionFactory
- java.lang.Object
-
- com.adaptris.core.jms.ProducerSessionFactoryImpl
-
- com.adaptris.core.jms.MessageSizeProducerSessionFactory
-
- All Implemented Interfaces:
ComponentLifecycle
,ProducerSessionFactory
public class MessageSizeProducerSessionFactory extends ProducerSessionFactoryImpl
Implementation ofProducerSessionFactory
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.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.jms.ProducerSessionFactoryImpl
log, session
-
-
Constructor Summary
Constructors Constructor Description MessageSizeProducerSessionFactory()
MessageSizeProducerSessionFactory(java.lang.Long max)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class com.adaptris.core.jms.ProducerSessionFactoryImpl
close, closeQuietly, createProducerSession
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
start, stop
-
-
-
-
Method Detail
-
createProducerSession
public ProducerSession createProducerSession(JmsProducerImpl producer, AdaptrisMessage msg) throws javax.jms.JMSException
Description copied from interface:ProducerSessionFactory
Create or reuse an existing session.- Parameters:
producer
- theJmsProducerImpl
instancemsg
- the message that the producer is currently handling.- Returns:
- a
ProducerSession
- Throws:
javax.jms.JMSException
- if there was a problem creating the session.
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
init
in interfaceComponentLifecycle
- Overrides:
init
in classProducerSessionFactoryImpl
- Throws:
CoreException
- wrapping any underlyingException
s
-
getMaxSizeBytes
public java.lang.Long getMaxSizeBytes()
-
setMaxSizeBytes
public void setMaxSizeBytes(java.lang.Long max)
Set the maximum accumulated size of messages before a session refresh is required.- Parameters:
max
- the max size of messages; if not specified, defaults to 10 megabytes.
-
-