{
  "id": "register-events",
  "title": "Register events",
  "url": "https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/gears-v1/register-events/",
  "summary": "Register RedisGears functions to run when certain events occur in a Redis database.",
  "tags": [
    "docs",
    "operate",
    "stack"
  ],
  "last_updated": "2026-04-22T11:55:45+02:00",
  "page_type": "content",
  "content_hash": "0aa6bb7bc022ba49aacea760c2d9b175c026e41dd1c98f3c1975d83c3960663a",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "You can register RedisGears functions to run when certain events occur in a Redis database."
    },
    {
      "id": "register-on-events",
      "title": "Register on events",
      "role": "content",
      "text": "To register RedisGears functions to run on an event, your code needs to:\n\n1. Pass `KeysReader` to a `GearsBuilder` object.\n\n1. Call the `GearsBuilder.register()` function.\n\n1. Pass the `eventTypes` parameter to either:\n\n    - The `register` function for Python.\n    \n    - The `KeysReader` object for Java.\n\nFor more information and examples of event registration, see:\n\n- Java references:\n\n    - [`KeysReader`](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/gears-v1/jvm/classes/readers/keysreader)\n\n    - [`GearsBuilder.register()`](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/gears-v1/jvm/classes/gearsbuilder/register)"
    },
    {
      "id": "event-types",
      "title": "Event types",
      "role": "content",
      "text": "For the list of event types you can register on, see the [Redis keyspace notification documentation](https://redis.io/docs/latest/develop/pubsub/keyspace-notifications#events-generated-by-different-commands)."
    },
    {
      "id": "active-active-event-types",
      "title": "Active-Active event types",
      "role": "content",
      "text": "In addition to standard Redis [events](https://redis.io/docs/latest/develop/pubsub/keyspace-notifications#events-generated-by-different-commands), [Redis Software Active-Active databases](https://redis.io/docs/latest/operate/rs/databases/active-active) also support the registration of RedisGears functions for the following event types:\n\n- `change`: This event occurs when a key changes on another replica of the Active-Active database."
    }
  ],
  "examples": []
}
