Package com.adaptris.core.jms
Class MessageCountProducerSessionFactory
- java.lang.Object
-
- com.adaptris.core.jms.ProducerSessionFactoryImpl
-
- com.adaptris.core.jms.MessageCountProducerSessionFactory
-
- All Implemented Interfaces:
ComponentLifecycle
,ProducerSessionFactory
public class MessageCountProducerSessionFactory extends ProducerSessionFactoryImpl
Implementation ofProducerSessionFactory
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.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.jms.ProducerSessionFactoryImpl
log, session
-
-
Constructor Summary
Constructors Constructor Description MessageCountProducerSessionFactory()
MessageCountProducerSessionFactory(java.lang.Integer 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.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.-
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
-
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
-
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.
-
getMaxMessages
public java.lang.Integer getMaxMessages()
-
setMaxMessages
public void setMaxMessages(java.lang.Integer max)
Set the maximum number of messages before a session refresh is required.- Parameters:
max
- the max number of messages; if not specified, defaults to 1024.
-
-