Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.transport
Class AbstractReceiverWorker

    java.lang.Object
      org.mule.transport.AbstractReceiverWorker

All Implemented Interfaces:
  Runnable, javax.resource.spi.work.Work

Direct Known Subclasses:
  AbstractReceiverResourceWorker, JmsMessageReceiver.JmsWorker, MultiConsumerJmsMessageReceiver.JmsWorker

    public abstract class AbstractReceiverWorker

extends Object
implements javax.resource.spi.work.Work

A base Worker used by Transport `MessageReceiver` implementations.

Field Summary
`protected InboundEndpoint` | `endpoint`
`protected List<Object>` | `messages`
`protected OutputStream` | `out`
`protected AbstractMessageReceiver` | `receiver`

Constructor Summary
`AbstractReceiverWorker(List<Object> messages, AbstractMessageReceiver receiver)`
`AbstractReceiverWorker(List<Object> messages, AbstractMessageReceiver receiver, OutputStream out)`

Method Summary
`protected abstract void` | `bindTransaction(Transaction tx)` Template method used to bind the resources of this receiver to the transaction.
`protected void` | `doRun()` The actual logic used to receive messages from the underlying transport.
`protected void` | `handleResults(List messages)` When Mule has finished processing the current messages, there may be zero or more messages to process by the receiver if request/response messaging is being used.
`protected MuleMessage` | `postProcessMessage(MuleMessage message)` If a result is returned back this method will get called before the message is added to te list of results (these are later passed to `handleResults(java.util.List)`)
`protected Object` | `preProcessMessage(Object message)` Before a message is passed into Mule this callback is called and can be used by the worker to inspect the message before it gets sent to Mule
`protected void` | `preRouteMuleMessage(MuleMessage message)` This callback is called before a message is routed into Mule and can be used by the worker to set connection specific properties to message before it gets routed
`void` | `release()` This method is called once this worker is no longer required.
`void` | `run()` This will run the receiver logic and call `release()` once `doRun()` completes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### messages

    protected List<Object> messages

### endpoint

    protected InboundEndpoint endpoint

### receiver

    protected AbstractMessageReceiver receiver

### out

    protected OutputStream out

Constructor Detail

### AbstractReceiverWorker

    public AbstractReceiverWorker(List<Object> messages,
                                  AbstractMessageReceiver receiver)

### AbstractReceiverWorker

    public AbstractReceiverWorker(List<Object> messages,
                                  AbstractMessageReceiver receiver,
                                  OutputStream out)

Method Detail

### run

    public final void run()

  This will run the receiver logic and call `release()` once `doRun()` completes.

  Specified by:
    `run` in interface `Runnable`

### doRun

    protected void doRun()

  The actual logic used to receive messages from the underlying transport. The default implementation will execute the processing of messages within a TransactionTemplate. This template will manage the transaction lifecycle for the list of messages associated with this receiver worker.

### preRouteMuleMessage

    protected void preRouteMuleMessage(MuleMessage message)
                                throws Exception

  This callback is called before a message is routed into Mule and can be used by the worker to set connection specific properties to message before it gets routed

  Parameters:
    `message` - the next message to be processed
  Throws:
    `Exception`

### bindTransaction

    protected abstract void bindTransaction(Transaction tx)
                                     throws TransactionException

  Template method used to bind the resources of this receiver to the transaction. Only transactional transports need implment this method

  Parameters:
    `tx` - the current transaction or null if there is no transaction
  Throws:
    `TransactionException`

### handleResults

    protected void handleResults(List messages)
                          throws Exception

  When Mule has finished processing the current messages, there may be zero or more messages to process by the receiver if request/response messaging is being used. The result(s) should be passed back to the callee.

  Parameters:
    `messages` - a list of messages. This argument will not be null
  Throws:
    `Exception`

### preProcessMessage

    protected Object preProcessMessage(Object message)
                                throws Exception

  Before a message is passed into Mule this callback is called and can be used by the worker to inspect the message before it gets sent to Mule

  Parameters:
    `message` - the next message to be processed
  Returns:
    the message to be processed. If Null is returned the message will not get processed.
  Throws:
    `Exception`

### postProcessMessage

    protected MuleMessage postProcessMessage(MuleMessage message)
                                      throws Exception

  If a result is returned back this method will get called before the message is added to te list of results (these are later passed to `handleResults(java.util.List)`)

  Parameters:
    `message` - the result message, this will never be null
  Returns:
    the message to add to the list of results. If null is returned nothing is added to the list of results
  Throws:
    `Exception`

### release

    public void release()

  This method is called once this worker is no longer required. Any resources *only* associated with this worker should be cleaned up here.

  Specified by:
    `release` in interface `javax.resource.spi.work.Work`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.