atg.b2bcommerce.invoice.messaging
Class SimpleInvoiceMessageSink

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.b2bcommerce.invoice.messaging.SimpleInvoiceMessageSink
All Implemented Interfaces:
MessageSink, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class SimpleInvoiceMessageSink
extends GenericService
implements MessageSink

MessageSink implementation that knows how to decode an ObjectMessage generated by the InvoiceManager and retrieve the underlying message bean, which is assumed to be of type InvoiceMessage.

This class may be useful as a base class for message sinks that listen for an operate on invoice-related messages. Subclasses can override the handleMessage(String, InvoiceMessage) method to process the message without worrying about how the data is packaged in the surrounding ObjectMessage

See Also:
InvoiceMessage

Field Summary
static java.lang.String CLASS_VERSION
           
protected static java.util.ResourceBundle sDefaultResources
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
SimpleInvoiceMessageSink()
           
 
Method Summary
 void handleMessage(java.lang.String pPortName, java.lang.String pMessageType, InvoiceMessage pInvoiceMsg)
          Handle a single InvoiceMessage.
 void receiveMessage(java.lang.String pPortName, javax.jms.Message pMessage)
          Implements the MessageSink interface by examining the type of the message and verifying that it is a JMS ObjectMessage, then retrieving the underlying object data and verifying that it is of type InvoiceMessage before calling handleMessage on it.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

sDefaultResources

protected static java.util.ResourceBundle sDefaultResources
Constructor Detail

SimpleInvoiceMessageSink

public SimpleInvoiceMessageSink()
Method Detail

receiveMessage

public void receiveMessage(java.lang.String pPortName,
                           javax.jms.Message pMessage)
                    throws javax.jms.JMSException,
                           java.lang.IllegalArgumentException
Implements the MessageSink interface by examining the type of the message and verifying that it is a JMS ObjectMessage, then retrieving the underlying object data and verifying that it is of type InvoiceMessage before calling handleMessage on it.

Specified by:
receiveMessage in interface MessageSink
Parameters:
pPortName - The port on which the message arrived.
pMessage - The raw JMS message being received.
Throws:
javax.jms.JMSException - if any of the JMS methods used throw an exception
java.lang.IllegalArgumentException - if either pMessage or the underlying Dynamo Message Bean is not of the expected type.

handleMessage

public void handleMessage(java.lang.String pPortName,
                          java.lang.String pMessageType,
                          InvoiceMessage pInvoiceMsg)
Handle a single InvoiceMessage. This method is called by receiveMessage once it has verified that all of the message components are of the expected type. The default implementation does nothing but log debugging information about the message if loggingDebug is set to true. Subclasses can override this method to add application-specific message processing.

Parameters:
pPortName - The port on which the message arrived.
pMessageType - The JMS message type specifier for the original message.
pInvoiceMsg - The InvoiceMessage object carrying the message data.