org.spicefactory.pimento.io
Class PimentoMessageProcessor

java.lang.Object
  extended by org.spicefactory.cinnamon.service.ServiceMessageProcessor
      extended by org.spicefactory.pimento.io.PimentoMessageProcessor
All Implemented Interfaces:
MessageProcessor<ServiceRequest,ServiceResponse>

public class PimentoMessageProcessor
extends ServiceMessageProcessor

Cinnamon ServiceMessageProcessor that processes all requests managed by Pimento. Replaces Cinnamon's builtin ServiceMessageProcessor.

Author:
Jens Halm

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.spicefactory.cinnamon.io.MessageProcessor
MessageProcessor.ResultHolder<O>
 
Constructor Summary
PimentoMessageProcessor(PimentoConfig config)
          Creates a new instance.
 
Method Summary
protected  void logRequest(ServiceRequest request)
           
protected  void logResult(ServiceRequest request, ServiceResponse response)
           
 MessageProcessor.ResultHolder<ServiceResponse> processMessage(ServiceRequest message)
          Processes the given request instance and returns a result.
 
Methods inherited from class org.spicefactory.cinnamon.service.ServiceMessageProcessor
isFailFast, processException, setFailFast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PimentoMessageProcessor

public PimentoMessageProcessor(PimentoConfig config)
Creates a new instance.

Parameters:
config - the Pimento configuration to apply
Method Detail

processMessage

public MessageProcessor.ResultHolder<ServiceResponse> processMessage(ServiceRequest message)
Description copied from interface: MessageProcessor
Processes the given request instance and returns a result. The returned ResultHolder instance holds the actual result instance and a boolean property indicating whether the result represents an error outcome. A message processor may also decide to throw an Exception instead of returning a result representing an error. In this case fail fast behaviour will be applied: The processing of subsequent messages in the same request will be prevented and all messages that were already processed will be reprocessed with the processException method. This may be useful if some kind of transactional behaviour needs to be applied to a batch of method invocations.

Specified by:
processMessage in interface MessageProcessor<ServiceRequest,ServiceResponse>
Overrides:
processMessage in class ServiceMessageProcessor
Parameters:
message - the object representing the request
Returns:
a ResultHolder instance containing the result to be sent to the client

logRequest

protected void logRequest(ServiceRequest request)
Overrides:
logRequest in class ServiceMessageProcessor

logResult

protected void logResult(ServiceRequest request,
                         ServiceResponse response)
Overrides:
logResult in class ServiceMessageProcessor