@InterfaceStability.Unstable public interface StreamGraph
MessageStream
s and OutputStream
s 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 . |
<K,V> Table<KV<K,V>> |
getTable(TableDescriptor<K,V,?> tableDesc)
Gets the
Table corresponding to the TableDescriptor . |
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
ClassCastException
s 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 MessageStream
streamId
- the unique ID for the streamserde
- the Serde
to use for deserializing incoming messagesMessageStream
java.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
ClassCastException
s at runtime.
Multiple invocations of this method with the same streamId
will throw an IllegalStateException
.
M
- the type of message in the input MessageStream
streamId
- the unique ID for the streamMessageStream
java.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 OutputStream
streamId
- the unique ID for the streamserde
- the Serde
to use for serializing outgoing messagesMessageStream
java.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
ClassCastException
s at runtime.
Multiple invocations of this method with the same streamId
will throw an IllegalStateException
.
M
- the type of messages in the OutputStream
streamId
- the unique ID for the streamMessageStream
java.lang.IllegalStateException
- when invoked multiple times with the same streamId
<K,V> Table<KV<K,V>> getTable(TableDescriptor<K,V,?> tableDesc)
Table
corresponding to the TableDescriptor
.
Multiple invocations of this method with the same TableDescriptor
will throw an
IllegalStateException
.
K
- the type of the keyV
- the type of the valuetableDesc
- the TableDescriptor
Table
corresponding to the tableDesc
java.lang.IllegalStateException
- when invoked multiple times with the same TableDescriptor
StreamGraph 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 StreamGraph
StreamGraph
with contextManager
set as its ContextManager