org.jboss.soa.esb.notification
Class NotifyJMS

java.lang.Object
  extended by org.jboss.soa.esb.notification.NotificationTarget
      extended by org.jboss.soa.esb.notification.NotifyJMS
Direct Known Subclasses:
NotifyQueues, NotifyTopics

public abstract class NotifyJMS
extends NotificationTarget

Abstract class that defines the behaviour of NotifyQueues and NotifyTopics (and in fact any other javax.jms.Destination object), and provides common methods to derived classes

Description:

Author: Heuristica - Buenos Aires - Argentina

Version:
1.0

Field Summary
static java.lang.String ATT_DEST_NAME
          Attribute name mnemonic for the att that will hold the JNDI name of the destination javax.jms.Destination object
static java.lang.String ATT_PROP_NAME
          Attribute name mnemonic for the name of the message property to fill with contents of the "value" aattribute
static java.lang.String ATT_PROP_VALUE
          Attribute name mnemonic for the value to assign to the corresponding message property
static java.lang.String CHILD_MSG_PROP
          Element name mnemonic to search for child elements in the ConfigTree at constructor time, that will hold a "name" "value" pair to be included in the JMS message header
protected  org.apache.log4j.Logger log
           
protected  javax.jms.MessageProducer[] m_oaMssProd
          Array with an instance of javax.jms.MessageProducer on each entry that will be used to send the notification at sendNotification() time
protected  javax.naming.Context[] m_oCtx
          This object holds the JNDI naming context that will be used to obtain a JMS destination (javax.jms.Destination) to send/publish the notification at sendNotification() time
protected  javax.jms.Session[] m_oSess
          The javax.jms.Session instance used to talk to JMS
protected  org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool[] mPool
          The javax.jms.Connection instance used to talk to JMS
 
Fields inherited from class org.jboss.soa.esb.notification.NotificationTarget
m_oParms, PRM_NOTIF_CLASS
 
Constructor Summary
protected NotifyJMS(ConfigTree p_oP)
          Constructor that will be called by child classes to perform initialization tasks that are common to all derived classes
 
Method Summary
 void release()
          Performs an orderly release of all JMS resources utilized - Well behaved developers should always call this method before unreferencing this object
protected abstract  void send(javax.jms.Message p_oMsg, javax.jms.MessageProducer msgProducer)
          Abstract method - All classes that extend NotifyJMS must implement it according to their own javax.jms.Destination needs (Queue/Topic)
 void sendNotification(Message esbMessage)
          Send a JMS message using p_o to fill in the message content and the list of message properties that will be added to the JMS message header fields
protected  void sendToAll(javax.jms.Message p_oMsg)
          Template method for sending JMS messages to destinations.
protected  void setJMSProperties(Message fromESBMessage, javax.jms.Message toJMSMessage)
          This method will set appropriate JMSProperties on the outgoing JMSMessage object.
 void setJmsPropertiesStrategy(JMSPropertiesSetter jmsPropertiesStrategy)
          Sets the strategy for handling the setting of properties on an outgoing JMS Message.
 
Methods inherited from class org.jboss.soa.esb.notification.NotificationTarget
fromParams
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.log4j.Logger log

CHILD_MSG_PROP

public static final java.lang.String CHILD_MSG_PROP
Element name mnemonic to search for child elements in the ConfigTree at constructor time, that will hold a "name" "value" pair to be included in the JMS message header

See Also:
Constant Field Values

ATT_PROP_NAME

public static final java.lang.String ATT_PROP_NAME
Attribute name mnemonic for the name of the message property to fill with contents of the "value" aattribute

See Also:
Constant Field Values

ATT_PROP_VALUE

public static final java.lang.String ATT_PROP_VALUE
Attribute name mnemonic for the value to assign to the corresponding message property

See Also:
Constant Field Values

ATT_DEST_NAME

public static final java.lang.String ATT_DEST_NAME
Attribute name mnemonic for the att that will hold the JNDI name of the destination javax.jms.Destination object

See Also:
Constant Field Values

m_oCtx

protected javax.naming.Context[] m_oCtx
This object holds the JNDI naming context that will be used to obtain a JMS destination (javax.jms.Destination) to send/publish the notification at sendNotification() time


mPool

protected org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool[] mPool
The javax.jms.Connection instance used to talk to JMS


m_oSess

protected javax.jms.Session[] m_oSess
The javax.jms.Session instance used to talk to JMS


m_oaMssProd

protected javax.jms.MessageProducer[] m_oaMssProd
Array with an instance of javax.jms.MessageProducer on each entry that will be used to send the notification at sendNotification() time

Constructor Detail

NotifyJMS

protected NotifyJMS(ConfigTree p_oP)
             throws ConfigurationException
Constructor that will be called by child classes to perform initialization tasks that are common to all derived classes

Parameters:
p_oP - ConfigTree

Will contain a variable number of "messageProp" child elements that will be added to messages sent to

Throws:
ConfigurationException
Method Detail

send

protected abstract void send(javax.jms.Message p_oMsg,
                             javax.jms.MessageProducer msgProducer)
                      throws javax.jms.JMSException
Abstract method - All classes that extend NotifyJMS must implement it according to their own javax.jms.Destination needs (Queue/Topic)

Parameters:
p_oMsg - the JMS Message to send
msgProducer - the JMS Message Producer which will perform the sending
Throws:
javax.jms.JMSException - if the send was not sucessful

release

public void release()
Performs an orderly release of all JMS resources utilized - Well behaved developers should always call this method before unreferencing this object


sendNotification

public void sendNotification(Message esbMessage)
                      throws NotificationException
Send a JMS message using p_o to fill in the message content and the list of message properties that will be added to the JMS message header fields

Specified by:
sendNotification in class NotificationTarget
Parameters:
esbMessage - Object - This object or thie object's toString() method will supply contents of JMS message
Throws:
NotificationException - - invoke Exception.getMessage() at runtime for this object
See Also:
CHILD_MSG_PROP

setJMSProperties

protected void setJMSProperties(Message fromESBMessage,
                                javax.jms.Message toJMSMessage)
                         throws javax.jms.JMSException
This method will set appropriate JMSProperties on the outgoing JMSMessage object.

Sublclasses can either override this method add a different behaviour, or they can set the strategy by calling setJmsPropertiesStrategy(JMSPropertiesSetter).

See JMSPropertiesSetter for more info.

Throws:
javax.jms.JMSException

sendToAll

protected void sendToAll(javax.jms.Message p_oMsg)
                  throws javax.jms.JMSException
Template method for sending JMS messages to destinations.

Subclasses implement send(Message, MessageProducer) which performs sending/publishing.

Parameters:
p_oMsg - the JMS Message to send.
Throws:
javax.jms.JMSException - if any of the sends fail a JMSException will be thrown. The exception will contain an error message and stacktrace for every failed send.

setJmsPropertiesStrategy

public void setJmsPropertiesStrategy(JMSPropertiesSetter jmsPropertiesStrategy)
Sets the strategy for handling the setting of properties on an outgoing JMS Message.

Parameters:
jmsPropertiesStrategy - the strategy to use.