org.apache.logging.log4j.core.appender.mom
Class JmsManager

java.lang.Object
  extended by org.apache.logging.log4j.core.appender.AbstractManager
      extended by org.apache.logging.log4j.core.appender.mom.JmsManager

public class JmsManager
extends AbstractManager

JMS connection and session manager. Can be used to access MessageProducer, MessageConsumer, and Message objects involving a configured ConnectionFactory and Destination.


Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractManager
count
 
Method Summary
 Message createMessage(Serializable object)
          Creates a TextMessage or ObjectMessage from a Serializable object.
 MessageConsumer createMessageConsumer()
          Creates a MessageConsumer on this Destination using the current Session.
 MessageProducer createMessageProducer()
          Creates a MessageProducer on this Destination using the current Session.
static JmsManager getJmsManager(String name, JndiManager jndiManager, String connectionFactoryName, String destinationName, String username, String password)
          Gets a JmsManager using the specified configuration parameters.
protected  void releaseSub()
          May be overridden by Managers to perform processing while the Manager is being released and the lock is held.
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractManager
getContentFormat, getCount, getManager, getName, hasManager, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getJmsManager

public static JmsManager getJmsManager(String name,
                                       JndiManager jndiManager,
                                       String connectionFactoryName,
                                       String destinationName,
                                       String username,
                                       String password)
Gets a JmsManager using the specified configuration parameters.

Parameters:
name - The name to use for this JmsManager.
jndiManager - The JndiManager to look up JMS information through.
connectionFactoryName - The binding name for the ConnectionFactory.
destinationName - The binding name for the Destination.
username - The username to connect with or null for no authentication.
password - The password to use with the given username or null for no authentication.
Returns:
The JmsManager as configured.

createMessageConsumer

public MessageConsumer createMessageConsumer()
                                      throws JMSException
Creates a MessageConsumer on this Destination using the current Session.

Returns:
A MessageConsumer on this Destination.
Throws:
JMSException

createMessageProducer

public MessageProducer createMessageProducer()
                                      throws JMSException
Creates a MessageProducer on this Destination using the current Session.

Returns:
A MessageProducer on this Destination.
Throws:
JMSException

createMessage

public Message createMessage(Serializable object)
                      throws JMSException
Creates a TextMessage or ObjectMessage from a Serializable object. For instance, when using a text-based Layout such as PatternLayout, the LogEvent message will be serialized to a String. When using a layout such as SerializedLayout, the LogEvent message will be serialized as a Java object.

Parameters:
object - The LogEvent or String message to wrap.
Returns:
A new JMS message containing the provided object.
Throws:
JMSException

releaseSub

protected void releaseSub()
Description copied from class: AbstractManager
May be overridden by Managers to perform processing while the Manager is being released and the lock is held.

Overrides:
releaseSub in class AbstractManager


Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.