Class InboundConsumer
- java.lang.Object
-
- org.objectweb.joram.client.connector.InboundConsumer
-
- All Implemented Interfaces:
ServerSessionPool,InboundConsumerMBean
public class InboundConsumer extends Object implements ServerSessionPool, InboundConsumerMBean
AnInboundConsumerinstance is responsible for consuming messages from a given JORAM destination and through a given JORAM connection.
-
-
Field Summary
Fields Modifier and Type Field Description private intackModeprivate booleancloseDurSubfor closing durable subscriptionprivate XAConnectioncnxThe provided connection to the underlying JORAM server.private ConnectionConsumercnxConsumerWrappedConnectionConsumerinstance.private static booleanDEBUG(package private) MessageEndpointFactoryendpointFactoryApplication's endpoints factory.private static Loggerloggerprivate intmaxWorksMaximum number of Work instances to be submitted (0 for infinite).private Vector<ServerSession>poolPool of server sessions.private intserverSessionsNumber of created server sessions.private StringsubNameThe durable subscription name, if provided.private booleantransactedtrueif message consumption occurs in a transaction.private WorkManagerworkManagerApplication server'sWorkManagerinstance.
-
Constructor Summary
Constructors Constructor Description InboundConsumer(WorkManager workManager, MessageEndpointFactory endpointFactory, XAConnection cnx, Destination dest, String selector, boolean durable, String subName, boolean transacted, int maxWorks, int maxMessages, int ackMode, boolean closeDurSub)Constructs anInboundConsumerinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidclose()Closes the consumer.StringgetAckMode()the session mode.booleangetCloseDurSub()for closing durable subscriptionStringgetJMXBeanName(XAConnection cnx)intgetMaxWorks()Maximum number of Work instances to be submitted (0 for infinite).intgetPoolSize()Size of the pool of server sessions.ServerSessiongetServerSession()Provides a newInboundSessioninstance for processing incoming messages.intgetServerSessions()Number of created server sessions.String[]getSessions()StringgetSubName()The durable subscription name, if provided.booleangetTransacted()trueif message consumption occurs in a transaction.private InboundSessionnewSession()StringregisterMBean()(package private) voidreleaseSession(InboundSession session)Releases anInboundSessioninstance.voidunregisterMBean()
-
-
-
Field Detail
-
logger
private static final Logger logger
-
DEBUG
private static final boolean DEBUG
-
workManager
private WorkManager workManager
Application server'sWorkManagerinstance.
-
endpointFactory
MessageEndpointFactory endpointFactory
Application's endpoints factory.
-
cnx
private XAConnection cnx
The provided connection to the underlying JORAM server.
-
subName
private String subName
The durable subscription name, if provided.
-
transacted
private boolean transacted
trueif message consumption occurs in a transaction.
-
maxWorks
private int maxWorks
Maximum number of Work instances to be submitted (0 for infinite).
-
ackMode
private int ackMode
-
closeDurSub
private boolean closeDurSub
for closing durable subscription
-
cnxConsumer
private ConnectionConsumer cnxConsumer
WrappedConnectionConsumerinstance.
-
serverSessions
private int serverSessions
Number of created server sessions.
-
pool
private Vector<ServerSession> pool
Pool of server sessions.
-
-
Constructor Detail
-
InboundConsumer
public InboundConsumer(WorkManager workManager, MessageEndpointFactory endpointFactory, XAConnection cnx, Destination dest, String selector, boolean durable, String subName, boolean transacted, int maxWorks, int maxMessages, int ackMode, boolean closeDurSub) throws ResourceException
Constructs anInboundConsumerinstance.- Parameters:
workManager- Application server'sWorkManagerinstance.endpointFactory- Application's endpoints factory.cnx- Connection to the JORAM server.dest- Destination to get messages from.selector- Selector for filtering messages.durable-truefor durably subscribing.subName- Durable subscription name.transacted-trueif deliveries will occur in a XA transaction.maxWorks- Max number of Work instances to be submitted.- Throws:
NotSupportedException- If the activation parameters are invalid.SecurityException- If the target destination is not readable.CommException- If the connection with the JORAM server is lost.ResourceException- Generic exception.
-
-
Method Detail
-
getJMXBeanName
public String getJMXBeanName(XAConnection cnx)
-
registerMBean
public String registerMBean()
-
unregisterMBean
public void unregisterMBean()
-
getServerSession
public ServerSession getServerSession() throws JMSException
Provides a newInboundSessioninstance for processing incoming messages.- Specified by:
getServerSessionin interfaceServerSessionPool- Throws:
JMSException- Never thrown.
-
newSession
private InboundSession newSession()
-
releaseSession
void releaseSession(InboundSession session)
Releases anInboundSessioninstance.
-
close
void close()
Closes the consumer.
-
getSubName
public String getSubName()
Description copied from interface:InboundConsumerMBeanThe durable subscription name, if provided.- Specified by:
getSubNamein interfaceInboundConsumerMBean
-
getTransacted
public boolean getTransacted()
Description copied from interface:InboundConsumerMBeantrueif message consumption occurs in a transaction.- Specified by:
getTransactedin interfaceInboundConsumerMBean
-
getMaxWorks
public int getMaxWorks()
Description copied from interface:InboundConsumerMBeanMaximum number of Work instances to be submitted (0 for infinite).- Specified by:
getMaxWorksin interfaceInboundConsumerMBean
-
getAckMode
public String getAckMode()
Description copied from interface:InboundConsumerMBeanthe session mode.- Specified by:
getAckModein interfaceInboundConsumerMBean
-
getCloseDurSub
public boolean getCloseDurSub()
Description copied from interface:InboundConsumerMBeanfor closing durable subscription- Specified by:
getCloseDurSubin interfaceInboundConsumerMBean
-
getServerSessions
public int getServerSessions()
Description copied from interface:InboundConsumerMBeanNumber of created server sessions.- Specified by:
getServerSessionsin interfaceInboundConsumerMBean
-
getPoolSize
public int getPoolSize()
Description copied from interface:InboundConsumerMBeanSize of the pool of server sessions.- Specified by:
getPoolSizein interfaceInboundConsumerMBean
-
getSessions
public String[] getSessions()
- Specified by:
getSessionsin interfaceInboundConsumerMBean
-
-