hazelcast map listener example python
import hazelcast, logging
config = hazelcast.ClientConfig()
# Hazelcast.Address is the hostname or IP address, e.g. 'localhost:5701'
config.network_config.addresses.append('localhost5701')
# basic logging setup to see client logs
logging.basicConfig()
logging.getLogger().setLevel(logging.INFO)
client = hazelcast.HazelcastClient(config)
my_map = client.get_map("map-name").blocking()
print my_map
future = my_map.put("key", "async_val")
def item_added(event):
print("item_added", event)
def item_removed(event):
print("item_removed", event)
def item_updated(event):
print("item_updated", event)
my_map.add_entry_listener(include_value=True, added_func=item_added, removed_func=item_removed, updated_func=item_updated)
future = my_map.put("key1", "async_val")
future = my_map.put("key2", "async_val")
future = my_map.put("key", "new val")