@InterfaceStability.Unstable public interface StreamGraph
MessageStreams and OutputStreams used to describe application logic.| Modifier and Type | Method and Description |
|---|---|
<M> MessageStream<M> |
getInputStream(java.lang.String streamId)
Same as
getInputStream(String, Serde), but uses the default Serde provided via
setDefaultSerde(Serde) for deserializing input messages. |
<M> MessageStream<M> |
getInputStream(java.lang.String streamId,
Serde<M> serde)
Gets the input
MessageStream corresponding to the streamId. |
<M> OutputStream<M> |
getOutputStream(java.lang.String streamId)
Same as
getOutputStream(String, Serde), but uses the default Serde provided via
setDefaultSerde(Serde) for serializing output messages. |
<M> OutputStream<M> |
getOutputStream(java.lang.String streamId,
Serde<M> serde)
Gets the
OutputStream corresponding to the streamId. |
void |
setDefaultSerde(Serde<?> serde)
Sets the default
Serde to use for (de)serializing messages. |
StreamGraph |
withContextManager(ContextManager contextManager)
Sets the
ContextManager for this StreamGraph. |
void setDefaultSerde(Serde<?> serde)
Serde to use for (de)serializing messages.
. If the default serde is set, it must be set before creating any input or output streams.
If no explicit or default serdes are provided, a KVSerde<NoOpSerde, NoOpSerde> is used. This means that
any streams created without explicit or default serdes should be cast to MessageStream<KV<Object, Object>>.
Providing an incompatible message type for the input/output streams that use the default serde will result in
ClassCastExceptions at runtime.
serde - the default message Serde to use<M> MessageStream<M> getInputStream(java.lang.String streamId, Serde<M> serde)
MessageStream corresponding to the streamId.
An input MessageStream<KV<K, V>, which can be obtained by calling this method with a KVSerde<K, V>,
can receive messages of type KV<K, V>. An input MessageStream<M> with any other Serde<M>
can receive messages of type M - the key in the incoming message is ignored.
A KVSerde<NoOpSerde, NoOpSerde> or NoOpSerde may be used if the SystemConsumer
deserializes the incoming messages itself, and no further deserialization is required from the framework.
Multiple invocations of this method with the same streamId will throw an IllegalStateException.
M - the type of messages in the input MessageStreamstreamId - the unique ID for the streamserde - the Serde to use for deserializing incoming messagesMessageStreamjava.lang.IllegalStateException - when invoked multiple times with the same streamId<M> MessageStream<M> getInputStream(java.lang.String streamId)
getInputStream(String, Serde), but uses the default Serde provided via
setDefaultSerde(Serde) for deserializing input messages.
If no default serde has been provided before calling this method, a KVSerde<NoOpSerde, NoOpSerde>
is used. Providing a message type M that is incompatible with the default Serde will result in
ClassCastExceptions at runtime.
Multiple invocations of this method with the same streamId will throw an IllegalStateException.
M - the type of message in the input MessageStreamstreamId - the unique ID for the streamMessageStreamjava.lang.IllegalStateException - when invoked multiple times with the same streamId<M> OutputStream<M> getOutputStream(java.lang.String streamId, Serde<M> serde)
OutputStream corresponding to the streamId.
An OutputStream<KV<K, V>>, which can be obtained by calling this method with a KVSerde<K, V>,
can send messages of type KV<K, V>. An OutputStream<M> with any other Serde<M> can
send messages of type M without a key.
A KVSerde<NoOpSerde, NoOpSerde> or NoOpSerde may be used if the SystemProducer
serializes the outgoing messages itself, and no prior serialization is required from the framework.
When sending messages to an OutputStream<KV<K, V>>, messages are partitioned using their serialized key.
When sending messages to any other OutputStream<M>, messages are partitioned using a null partition key.
Multiple invocations of this method with the same streamId will throw an IllegalStateException.
M - the type of messages in the OutputStreamstreamId - the unique ID for the streamserde - the Serde to use for serializing outgoing messagesMessageStreamjava.lang.IllegalStateException - when invoked multiple times with the same streamId<M> OutputStream<M> getOutputStream(java.lang.String streamId)
getOutputStream(String, Serde), but uses the default Serde provided via
setDefaultSerde(Serde) for serializing output messages.
If no default serde has been provided before calling this method, a KVSerde<NoOpSerde, NoOpSerde>
is used. Providing a message type M that is incompatible with the default Serde will result in
ClassCastExceptions at runtime.
Multiple invocations of this method with the same streamId will throw an IllegalStateException.
M - the type of messages in the OutputStreamstreamId - the unique ID for the streamMessageStreamjava.lang.IllegalStateException - when invoked multiple times with the same streamIdStreamGraph withContextManager(ContextManager contextManager)
ContextManager for this StreamGraph.
The provided ContextManager can be used to setup shared context between the operator functions
within a task instance
contextManager - the ContextManager to use for the StreamGraphStreamGraph with contextManager set as its ContextManager