biz.hammurapi.jms.adapter.jca
Class ActivationProcessor

java.lang.Object
  extended by biz.hammurapi.jms.adapter.jca.ActivationProcessor
All Implemented Interfaces:
Processor

public class ActivationProcessor
extends java.lang.Object
implements Processor

Passes objects to endpoints to be processed in worker threads. If endpoint is instance of MessageListener and object is instance of message then message is passed to the listener. If endpoint is instance of Processor then object is passed to the processor. Otherwise, if object is instance of Invocation then the invocation is executed against the endpoint. If none of this is true then message is discarded and a warning is logged. In the case of invocation, if the target method returns value and there are multiple endpoints listening then there are two options - a) return value from one of registered endpoints is returned (default) b) all values are assembled into a collection and returned. This behavior is controlled by "collectAllResults" parameter. The same is true if endpoints provide processor instances. Nulls are not collected and not sent back. Empty results collection is not sent back either.

Author:
Pavel

Constructor Summary
ActivationProcessor()
           
 
Method Summary
 void configure(java.util.Set activations, javax.resource.spi.work.WorkManager workManager)
           
 long getTimeout()
           
 boolean isCollectAllResults()
           
 java.lang.Object process(java.lang.Object obj)
          Collects non-null returns from registered endpoints and returns them as collection Returns null if collection is empty.
 void setCollectAllResults(boolean collectAllReturns)
          If set to true then value returned from process is a collection of all return
 void setTimeout(long timeout)
          Timeout for collection of results from all work items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivationProcessor

public ActivationProcessor()
Method Detail

configure

public void configure(java.util.Set activations,
                      javax.resource.spi.work.WorkManager workManager)

setTimeout

public void setTimeout(long timeout)
Timeout for collection of results from all work items.

Parameters:
timeout -

getTimeout

public long getTimeout()

setCollectAllResults

public void setCollectAllResults(boolean collectAllReturns)
If set to true then value returned from process is a collection of all return

Parameters:
collectAllReturns -

isCollectAllResults

public boolean isCollectAllResults()

process

public java.lang.Object process(java.lang.Object obj)
                         throws java.lang.Exception
Collects non-null returns from registered endpoints and returns them as collection Returns null if collection is empty.

Specified by:
process in interface Processor
Returns:
Processing result. This result is sent as a reply from listener.
Throws:
java.lang.Exception - If exception is thrown it is also serialized and sent as error reply.


Copyright © 2006 Hammurapi Group. All Rights Reserved.