vert-x3 / vertx-config

Vert.x Configuration Service
Apache License 2.0
54 stars 64 forks source link

Listening to the changes in redis #29

Closed Sergey80 closed 6 years ago

Sergey80 commented 6 years ago

I would expect that this could that listens to the my-microservice-config's values

Here I

  1. create a redis store
  2. configure retrive options (every 2 sec).
  3. set the options to the retriver

Then if I change a value for the my-microservice-config then it would trigger the System.out.ptintln("123") output.

This seems does not work.

Also (speaking about ConfigStoreOptions abstraction) seems we may not use .setScanPeriod(2000) since it come with pub-sub capabilities already so it would notify as it is changed.

Here is the code I use to test it:

final ConfigStoreOptions redisSore = new ConfigStoreOptions()
            .setType("redis")
            .setConfig(new JsonObject()
                .put("host", "localhost")
                .put("port", 6379)
                .put("key", "my-microservice-config")
            );

        final ConfigRetrieverOptions options = new ConfigRetrieverOptions()   // listen to the config changes
            .setScanPeriod(2000)
            .addStore(redisSore);

        final ConfigRetriever retriever = ConfigRetriever.create(vertx, options);
        retriever.getConfig( ar -> {
            if ( ar.failed()) {

                } else {
                System.out.ptintln("123");  // never reach this after value change
                final JsonObject jsonConfig = ar.result();
cescoffier commented 6 years ago

It should work, do you have a reproducer?

Sergey80 commented 6 years ago

Will prepare it today.

On Wed, Nov 22, 2017, 2:14 AM Clement Escoffier, notifications@github.com wrote:

It should work, do you have a reproducer?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vert-x3/vertx-config/issues/29#issuecomment-346263092, or mute the thread https://github.com/notifications/unsubscribe-auth/ADOsHrh4GnCuTO7BtEPHkrif3NJXBhZDks5s48nBgaJpZM4Qmqku .

cescoffier commented 6 years ago

Ping @Sergey80

cescoffier commented 6 years ago

Close due to inactivity. Please reopen if you still have the issue.