3 Replies Latest reply on Aug 18, 2017 5:06 AM by Zach Visagie

    CDIExtensionPoints startupCallback vs RPC

    Zach Visagie Newbie



      I am working on having MessageBus objects injectable in a Spring context and have been looking at the CDIExtensionPoints class based on recommendation from Max.


      I am trying to figure out why some services are subscribed in the StartupCallback in a scheduled execution where the bean instances are looked up as they become available, whereas the RPC remote interfaces are subscribed right away with a proxy class that looks up the bean:


        private void subscribeServices(final BeanManager beanManager, final MessageBus bus) {
           * Due to the lack of contract in CDI guaranteeing when beans will be available, we use an
           * executor to search for the beans every 100ms until it finds them. Or, after a 25 seconds,
           * blow up if they don't become available.
          final ScheduledExecutorService startupScheduler = Executors.newScheduledThreadPool(1);
          startupScheduler.scheduleAtFixedRate(new StartupCallback(beanManager, bus, startupScheduler, 25), 0, 100,
          for (final Class<?> remoteInterfaceType : managedTypes.getRemoteInterfaces()) {
            if (!managedTypes.isRemoteInterfaceImplemented(remoteInterfaceType)) {
              log.warn("No @Service implementations found for " + remoteInterfaceType.getName());
            createRPCScaffolding(remoteInterfaceType, bus, beanManager);


      I have basic RPC integration working by reworking an example in this old post: Errai 2.2.0.Final + Spring (RCP service example). It does not however cater for plain MessageCallback implementations or the Command annotation and I'd like to cater for whatever is leading to the two different approaches above. Any insights would be appreciated...