public final class ProtobufRouter extends java.lang.Object implements Router<com.google.protobuf.Message>
Protocol Buffers
DynamicMessage
s based on an address template string.
Route messages downstream to an address determined by an address template of the form
target-function-namespace/target-function-type/target-function-id. Each address template
component can reference a section of the input DynamicMessage
by using ProtobufPath
expressions.
For example consider the following Protocol Buffers
message type
message MyInput {
string name = 1;
}
And an instance of the message { "name" : "bob" }
, and the following template string:
"org.apache.flink/python-function/{{$.name}}".
This message would be routed to the address: Address(FunctionType(org.apache.flink,
python-function), bob)
.
Router.Downstream<T>
Modifier and Type | Method and Description |
---|---|
static ProtobufRouter |
forAddressTemplate(com.google.protobuf.Descriptors.Descriptor descriptor,
java.lang.String addressTemplate) |
void |
route(com.google.protobuf.Message message,
Router.Downstream<com.google.protobuf.Message> downstream)
Routes a given message to downstream
StatefulFunction s. |
public static ProtobufRouter forAddressTemplate(com.google.protobuf.Descriptors.Descriptor descriptor, java.lang.String addressTemplate)
public void route(com.google.protobuf.Message message, Router.Downstream<com.google.protobuf.Message> downstream)
Router
StatefulFunction
s. A single message may result in
multiple functions being invoked.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.