Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-12319

Redis base support

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.8
    • Component/s: Redis
    • Tags:
    • Backlog priority:
      600
    • Impact type:
      API change, Configuration Change
    • Upgrade notes:
      Hide

      Redis can be enabled from nuxeo.conf:

      nuxeo.redis.enabled=true
      nuxeo.redis.host=localhost (this is the default)
      nuxeo.redis.port=6379 (this is the default)

      Also available are (with defaults):

      nuxeo.redis.prefix=nuxeo:work:
      nuxeo.redis.password=
      nuxeo.redis.database=0
      nuxeo.redis.timeout=2000

      This automatically activates the Redis-based WorkManage queuing, unless the nuxeo.conf property nuxeo.work.queuing is not set to redis.

      To configure Redis manually, this extension point can be used:

      <extension target="org.nuxeo.ecm.core.redis.RedisService" point="configuration">
      <redis disabled="false">
      <prefix>nuxeo:work:</prefix>
      <host>localhost</host>
      <port>6379</port>
      <password>secret</password>
      <database>0</database>
      <timeout>2000</timeout>
      </redis>
      </extension>

      To use the Redis service, do:

      RedisService redisService = Framework.getLocalService(RedisService.class);

      This service currently provides two methods:

      redisService.getJedisPool();
      redisService.getPrefix(); // should be used as prefix for any key

      Standard usage pattern is:

      protected Jedis getJedis()

      { return redisService.getJedisPool().getResource(); }

      protected void closeJedis(Jedis jedis)

      { redisService.getJedisPool().returnResource(jedis); }

      protected void myMethod() throws IOException {
      Jedis jedis = getJedis();
      try

      { // ... use jedis here ... // ... all keys should be prefixed with redisService.getPrefix() }

      finally

      { closeJedis(jedis); }

      }

      Show
      Redis can be enabled from nuxeo.conf: nuxeo.redis.enabled=true nuxeo.redis.host=localhost (this is the default) nuxeo.redis.port=6379 (this is the default) Also available are (with defaults): nuxeo.redis.prefix=nuxeo:work: nuxeo.redis.password= nuxeo.redis.database=0 nuxeo.redis.timeout=2000 This automatically activates the Redis-based WorkManage queuing, unless the nuxeo.conf property nuxeo.work.queuing is not set to redis. To configure Redis manually, this extension point can be used: <extension target="org.nuxeo.ecm.core.redis.RedisService" point="configuration"> <redis disabled="false"> <prefix>nuxeo:work:</prefix> <host>localhost</host> <port>6379</port> <password>secret</password> <database>0</database> <timeout>2000</timeout> </redis> </extension> To use the Redis service, do: RedisService redisService = Framework.getLocalService(RedisService.class); This service currently provides two methods: redisService.getJedisPool(); redisService.getPrefix(); // should be used as prefix for any key Standard usage pattern is: protected Jedis getJedis() { return redisService.getJedisPool().getResource(); } protected void closeJedis(Jedis jedis) { redisService.getJedisPool().returnResource(jedis); } protected void myMethod() throws IOException { Jedis jedis = getJedis(); try { // ... use jedis here ... // ... all keys should be prefixed with redisService.getPrefix() } finally { closeJedis(jedis); } }

      Description

      Several components in Nuxeo will make use of Redis as an optional feature.

      We need a base service or helper for it.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.