O
- type of OutputTurn
I
- type of InputTurn
public interface DialogueChannel<I extends InputTurn,O extends OutputTurn>
DialogueChannel
is the interface between the
Dialogue
and the controller (such as the DialogueServlet
).
The dialogue produces OutputTurns
and sends them to the
controller via the doTurn(OutputTurn, Duration)
method. The
DialogueChannel will return the response from the controller as an
InputTurn
.
Note: The DialogueChannel
is typically wrapped in
DialogueContext
.
Modifier and Type | Method and Description |
---|---|
void |
addListener(DialogueChannelListener<I,O> listener)
Adds a listener to this dialogue channel.
|
I |
doTurn(O outputTurn,
Duration timeout)
Performs a turn exchange: the dialogue channel will return the
InputTurn |
void |
removeListener(DialogueChannelListener<I,O> listener)
Removes a listener from this dialogue channel.
|
I doTurn(O outputTurn, Duration timeout) throws Timeout, InterruptedException
InputTurn
outputTurn
- The output turn to send. Cannot be null
.timeout
- maximum time allowed to receive the turn from the
dialogue. If null
, uses the default value of this
dialogue channel. A value of Duration.ZERO (or equivalent)
means to wait forever.InputTurn
. Cannot be null
.Timeout
- if the dialogue channel has not been able to give the
InputTurn before timeout
parameter.InterruptedException
- if the thread has been interrupted while
waiting for the result.void addListener(DialogueChannelListener<I,O> listener)
listener
- the listener to add.void removeListener(DialogueChannelListener<I,O> listener)
listener
- the listener to remove.Copyright © 2019 Nu Echo Inc..