Java Code Examples for org.apache.flink.runtime.state.KeyedStateBackend#getOrCreateKeyedState()

The following examples show how to use org.apache.flink.runtime.state.KeyedStateBackend#getOrCreateKeyedState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FunctionGroupOperator.java    From stateful-functions with Apache License 2.0 5 votes vote down vote up
private InternalListState<String, Long, Message> delayedMessagesBufferState(
    ListStateDescriptor<Message> delayedMessageStateDescriptor) {
  try {
    KeyedStateBackend<String> keyedStateBackend = getKeyedStateBackend();
    return (InternalListState<String, Long, Message>)
        keyedStateBackend.getOrCreateKeyedState(
            LongSerializer.INSTANCE, delayedMessageStateDescriptor);
  } catch (Exception e) {
    throw new RuntimeException("Error registered Flink state for delayed messages buffer.", e);
  }
}
 
Example 2
Source File: FunctionGroupOperator.java    From flink-statefun with Apache License 2.0 5 votes vote down vote up
private InternalListState<String, Long, Message> delayedMessagesBufferState(
    ListStateDescriptor<Message> delayedMessageStateDescriptor) {
  try {
    KeyedStateBackend<String> keyedStateBackend = getKeyedStateBackend();
    return (InternalListState<String, Long, Message>)
        keyedStateBackend.getOrCreateKeyedState(
            LongSerializer.INSTANCE, delayedMessageStateDescriptor);
  } catch (Exception e) {
    throw new RuntimeException("Error registered Flink state for delayed messages buffer.", e);
  }
}