1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.jph.channels.process;
15
16 import org.jph.channels.OutputChannel;
17
18 /***
19 * The ProcessingOutputChannel is an OutputChannel that processes a message and posts the
20 * resulting message on an OutputChannel.
21 * <p/>
22 * The message is processed with by the Processor. If the Processor returns
23 * null, nothing is done (so no message is send to the OutputChannel). If the
24 * Processor sends back a message, that message is posted on the following channel.
25 * There is no guarantee that the returning msg will be processed. If the following channel
26 * doesn`t accept the offer (the put will succeed) the message is dropped. Maybe add a
27 * OfferRejectedHandler to give control to deal with this problem?
28 * <p/>
29 * If an error is encountered while processing the message, the ProcessExceptionHandler is
30 * called to deal with the error. (todo:not at the moment)
31 * <p/>
32 * The Message is processed on the Thread that called the put/offer. With the offer
33 * this gives problems because the maximum time between the offer being called on
34 * this ProcessingOutputChannel and moment the message succesfully was offered on the
35 * target is timeout + processingtime. This is something that has to be thought about
36 * (a good solution has to be found).
37 *
38 * @author Peter Veentjer.
39 */
40 public interface ProcessingOutputChannel<Min,Mout> extends OutputChannel<Min> {
41
42 /***
43 * Returns the Processor this ProcessingOutputChannel uses to process
44 * the messages.
45 */
46 Processor<Min, Mout> getMsgProcessor();
47
48 /***
49 * Returns the OutputChannel the resulting message (if it isn`t null) is send to.
50 */
51 OutputChannel<Mout> getTarget();
52
53
54 /***
55 * Return the ProcessExceptionHandler this ProcessingOutputChannel uses to deal
56 * with errors that occured while processing the message.
57 */
58 ProcessExceptionHandler<Min> getExceptionHandler();
59 }