org.marketcetera.modules.remote.receiver
Class ReceiverModule

java.lang.Object
  extended by org.marketcetera.module.Module
      extended by org.marketcetera.modules.remote.receiver.ReceiverModule
All Implemented Interfaces:
DataReceiver, ReceiverModuleMXBean

public class ReceiverModule
extends Module
implements DataReceiver, ReceiverModuleMXBean

A module that can receive any kind of data and emit it on a remotely accessible messaging topic so that the data can be received by remote recipients.

CapabilitiesData Receiver
Stops data flowsNo
Emits data flow errorsYes, when it's unable to serialize or send the object over JMS
Start OperationStarts the embedded JMS broker and connects to it.
Stop OperationStops the embedded broker.
Management InterfaceReceiverModuleMXBean
FactoryReceiverFactory

Remoting Mechanism

The module embeds a JMS message broker to transmit the messages to its clients. The message broker is configured with a single topic on which all the messages are broadcast. The broker is started when the module is started and stopped when the module is stopped.
Received Object Handling

The module will transmit all the received objects serialized as ObjectMessage. If the received object is not serializable, the module generates an error receiving that object which is handled and logged by the module framework. The module ignores null objects.
Authentication

The remote clients of this module need to authenticate themselves to the message broker in order to connect. This module depends on the client module for authentication. The client module needs to be connected to the server for the authentication to succeed and the credentials supplied must be the same as used by the client to connect to the server.

Do note that this module programmatically sets up the JAAS Configuration to make it easy to use. However, such a setup may conflict with other JAAS clients within the same JVM. If that happens, you can set the variable setSkipJAASConfiguration(boolean) to false and make sure that you setup the JAAS configuration yourself so that this module can work. Here's the JAAS configuration needed for authentication to work.

 remoting-amq-domain {
    org.marketcetera.modulews.remote.receiver.ClientLoginModule required;
 };
 

Since:
1.5.0
Version:
$Id: ReceiverModule.java 16154 2012-07-14 16:34:05Z colin $
Author:
anshul@marketcetera.com

Method Summary
 LogEventLevel getLogLevel()
          Gets the minimum log level of log events remotely transmitted by this module.
 String getURL()
          Gets the URL at which remote emitters should be able to connect to this module.
 boolean isSkipJAASConfiguration()
          If the module should skip the automatic JAAS configuration when it's started.
protected  void preStart()
           
protected  void preStop()
           
 void receiveData(DataFlowID inFlowID, Object inData)
           
 void setLogLevel(LogEventLevel inLevel)
          Sets the minimum log level of log events remotely transmitted by this module.
 void setSkipJAASConfiguration(boolean inSkipJAASConfiguration)
          Sets if the module should skip the automatic JAAS configuration when it's started.
 void setURL(String inURL)
          Sets the URL at which remote emitters should be able to connect to this module.
 
Methods inherited from class org.marketcetera.module.Module
getCreated, getLastStartFailure, getLastStopFailure, getStarted, getState, getStopped, getURN, isAutoCreated, isAutoStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

preStart

protected void preStart()
                 throws ModuleException
Specified by:
preStart in class Module
Throws:
ModuleException

preStop

protected void preStop()
                throws ModuleException
Specified by:
preStop in class Module
Throws:
ModuleException

receiveData

public void receiveData(DataFlowID inFlowID,
                        Object inData)
                 throws ReceiveDataException
Specified by:
receiveData in interface DataReceiver
Throws:
ReceiveDataException

getURL

public String getURL()
Description copied from interface: ReceiverModuleMXBean
Gets the URL at which remote emitters should be able to connect to this module.

Specified by:
getURL in interface ReceiverModuleMXBean
Returns:
the URL value.

setURL

public void setURL(String inURL)
Description copied from interface: ReceiverModuleMXBean
Sets the URL at which remote emitters should be able to connect to this module.

Specified by:
setURL in interface ReceiverModuleMXBean
Parameters:
inURL - the URL value.

getLogLevel

public LogEventLevel getLogLevel()
Description copied from interface: ReceiverModuleMXBean
Gets the minimum log level of log events remotely transmitted by this module.

The returned log level corresponds to the log-level for the system-wide logger category Messages.USER_MSG_CATEGORY.

Specified by:
getLogLevel in interface ReceiverModuleMXBean
Returns:
the log level value.

setLogLevel

public void setLogLevel(LogEventLevel inLevel)
Description copied from interface: ReceiverModuleMXBean
Sets the minimum log level of log events remotely transmitted by this module.

Setting this log level also sets the log level for the system-wide logger category Messages.USER_MSG_CATEGORY.

Do note for this function to work correctly the system logger category should not be specified in the log4j configuration file. The log4j configuration file is reread whenever it's updated. If the log4j configuration file contains configuration for the system logger category, it will over-write the configuration carried out via this method and result in confusing system behavior.

Specified by:
setLogLevel in interface ReceiverModuleMXBean
Parameters:
inLevel - the log level value.

isSkipJAASConfiguration

public boolean isSkipJAASConfiguration()
Description copied from interface: ReceiverModuleMXBean
If the module should skip the automatic JAAS configuration when it's started.

Specified by:
isSkipJAASConfiguration in interface ReceiverModuleMXBean
Returns:
if the module should skip the automatic JAAS configuration when it's started.

setSkipJAASConfiguration

public void setSkipJAASConfiguration(boolean inSkipJAASConfiguration)
Description copied from interface: ReceiverModuleMXBean
Sets if the module should skip the automatic JAAS configuration when it's started.

Specified by:
setSkipJAASConfiguration in interface ReceiverModuleMXBean
Parameters:
inSkipJAASConfiguration - if the automatic JAAS configuration should be skipped.


Copyright © 2012. All Rights Reserved.