SHARE
TWEET

Untitled

a guest Jan 11th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import hazelcast, logging
  2.  
  3. config = hazelcast.ClientConfig()
  4. # Hazelcast.Address is the hostname or IP address, e.g. 'localhost:5701'
  5. config.network_config.addresses.append('localhost5701')
  6.  
  7. # basic logging setup to see client logs
  8. logging.basicConfig()
  9. logging.getLogger().setLevel(logging.INFO)
  10.  
  11. client = hazelcast.HazelcastClient(config)
  12.  
  13. my_map = client.get_map("map-name").blocking()
  14. print my_map
  15.  
  16. future = my_map.put("key", "async_val")
  17.  
  18.  
  19. def item_added(event):
  20.     print("item_added", event)
  21.  
  22. def item_removed(event):
  23.     print("item_removed", event)
  24.  
  25. def item_updated(event):
  26.     print("item_updated", event)
  27.  
  28. my_map.add_entry_listener(include_value=True, added_func=item_added, removed_func=item_removed, updated_func=item_updated)
  29.  
  30. future = my_map.put("key1", "async_val")
  31. future = my_map.put("key2", "async_val")
  32. future = my_map.put("key", "new val")
RAW Paste Data
Top