class MyMapFunction(FlatMapFunction):
def open(self, runtime_context: RuntimeContext):
self.process_id_to_bus_seq = runtime_context.get_map_state(MapStateDescriptor('process_id_map_bus_seq', Types.STRING(), Types.STRING()))
self.gapslist=runtime_context.get_list_state(ListStateDescriptor('process_list', Types.LIST(Types.STRING())))
def flat_map(self, raw_message):
self.process_id_to_bus_seq.put(1234,4567)
print(dir(self.gapslist))
self.gapslist.add('11111111')
self.gapslist.add('22222222')
self.gapslist.add('33333333')
self.gapslist.add('444444444')
print(type(self.gapslist.get()))
a=''
for x in self.gapslist.get():
a=a+x
print(x)
print(a)
[root@kafka1 pyflink]# python test.py
['CacheType', '__abstractmethods__', '__class__', '__class_getitem__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__',
'__iter__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__orig_bases__', '__parameters__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__weakref__',
'_abc_impl', '_cache_type', '_internal_state', '_is_protocol', '_maybe_clear_write_cache', '_remote_state_backend', '_ttl_config', '_value_coder', 'add', 'add_all', 'clear', 'enable_time_to_live', 'get', 'get_internal_state',
'merge_namespaces', 'name', 'namespace', 'set_current_namespace', 'update']
11111111
22222222
33333333
444444444
111111112222222233333333444444444