Author Topic: Config server events  (Read 140 times)

Offline genesyslearner

  • Newbie
  • *
  • Posts: 31
  • Karma: 0
Config server events
« on: September 28, 2018, 03:25:58 PM »
Hi Experts,

I am trying to subscribe to config server events using Platform SDK (JAVA) so that we could be notified for any changes made to the config server.
I am sure that we need to user register and subscribe method of ConfService but i am struggling to use the register method for client registration.

Below is the code i could write but it is throwing me an error at the first line itself:-
                confService.register((Subscriber<ConfEvent>));
      NotificationQuery nq = new NotificationQuery();
      nq.setTenantDbid(1);
      confService.subscribe(nq);

Anys suggestions/pointers will be of great help.

Offline genesyslearner

  • Newbie
  • *
  • Posts: 31
  • Karma: 0
Re: Config server events
« Reply #1 on: October 02, 2018, 03:28:47 PM »
Hi Experts,

I was able to sort this issue. As Subscriber<ConfEvent> is an interface, i had to override the in-built methods:-

Please find below the code :-

Subscriber<ConfEvent> ce = new Subscriber<ConfEvent>() {

         @Override
         public void handle(ConfEvent ce) {
            // TODO Auto-generated method stub
            System.out.println("Subscribe person object event handler evenet type ::::: " +ce.getEventType());
            System.out.println("Subscribe person object event handler object type::::: " +ce.getObjectType());
         }

         @Override
         public Predicate<ConfEvent> getFilter() {
            // TODO Auto-generated method stub
            return null;
         }
      };
      service.register(ce);
      NotificationQuery nq = new NotificationQuery();
      nq.setTenantDbid(1);
      Subscription ss = service.subscribe(nq);