org.qi4j.library.eventsourcing.domain.source.helper

## Class UnitOfWorkRouter<T extends Throwable>

- java.lang.Object
- - org.qi4j.library.eventsourcing.domain.source.helper.UnitOfWorkRouter<T>

- All Implemented Interfaces:
    Output<UnitOfWorkDomainEventsValue,T>

      public class UnitOfWorkRouter<T extends Throwable>
      extends Object
      implements Output<UnitOfWorkDomainEventsValue,T>

  UnitOfWork handling router. Add specification->receiver routes. When a UnitOfWorkEDomainEventsValue comes in the router will ask each specification if it matches, and if so, delegate to the receiver. If no routes match, delegate to the default receiver.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnitOfWorkRouter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `UnitOfWorkRouter` | `defaultReceiver(Receiver<UnitOfWorkDomainEventsValue,T> defaultReceiver)`
    `<SenderThrowableType extends Throwable> void` | `receiveFrom(Sender<? extends UnitOfWorkDomainEventsValue,SenderThrowableType> sender)` This initiates a transfer from an Input.
    `UnitOfWorkRouter` | `route(Specification<UnitOfWorkDomainEventsValue> specification, Receiver<UnitOfWorkDomainEventsValue,T> receiver)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UnitOfWorkRouter

          public UnitOfWorkRouter()

  - ### Method Detail

    - #### route

          public UnitOfWorkRouter route(Specification<UnitOfWorkDomainEventsValue> specification,
                               Receiver<UnitOfWorkDomainEventsValue,T> receiver)

    - #### defaultReceiver

          public UnitOfWorkRouter defaultReceiver(Receiver<UnitOfWorkDomainEventsValue,T> defaultReceiver)

    - #### receiveFrom

          public <SenderThrowableType extends Throwable> void receiveFrom(Sender<? extends UnitOfWorkDomainEventsValue,SenderThrowableType> sender)
                           throws T extends Throwable,
                                  SenderThrowableType extends Throwable

      Description copied from interface: `Output`
      This initiates a transfer from an Input. Implementations should open any resources to be written to and then call sender.sendTo() when it is ready to receive data. When sendTo() returns the resource should be closed properly. Make sure to handle any exceptions from sendTo.
      Specified by:
        `receiveFrom` in interface `Output<UnitOfWorkDomainEventsValue,T extends Throwable>`
      Type Parameters:
        `SenderThrowableType` - the exception that sendTo can throw
      Parameters:
        `sender` - the sender of data to this output
      Throws:
        `SenderThrowableType` - the exception that the sender can throw
        `T extends Throwable`