3 Replies Latest reply on Oct 10, 2017 6:15 AM by ctomc

    Wildfly SuspendController Add OperationListener

    mfatih

      Hello!

      We have an application that has several tcp and udp connection using publish-subscribe pattern. Before shutting down the server(on Suspend state), the close information should be sent to subscribers and connections should be closed .

      So i need to add OperationListener to org.jboss.as.server.suspend.SuspendController.

      I released, implementing an extension to Wildfly so that I can get hold of the OperationContext and from there do context.getServiceRegistry(false).getService( SuspendController.SERVICE_NAME );

      But the extension did not work properly on domain mode.

      Another way adding Capability to Wildfly as described; Working with WildFly Capabilities - WildFly 10 - Project Documentation Editor

       

      What is the best way to listening SuspendListener.

      Thanks in advance;

       

      App Server : Wildfly 10.0.0..Final ( Domain Mode)

        • 1. Re: Wildfly SuspendController Add OperationListener
          ctomc

          If it doesn't work in domain, that just means you probably did some simple mistake in the subsystem wiring.

           

          any chance you can share your add handlers for extension and any sub resources you might have?

          1 of 1 people found this helpful
          • 2. Re: Wildfly SuspendController Add OperationListener
            mfatih

            After reviewing code, I realized i pass null ManagementResourceRegistration.registerOperationHandler method which was working standalone mode. I fixed that by following ;

             

            OperationDefinition def= new SimpleOperationDefinitionBuilder(DESCRIBE, ControllerResolver.getResolver("schema-locations")).build();       

            resourceRegistration.registerOperationHandler(def, GenericSubsystemDescribeHandler.INSTANCE,false);

             

            The extension code generation of maven archetypes is for Wildfly 8.0. It would be nice to add new archetype for wildfly 10+

             

            Thanks for response.

            • 3. Re: Wildfly SuspendController Add OperationListener
              ctomc

              ah describe handler, that should be even more simplified than that. yeah the archetypies are outdated, but samples are much more up-to-date 

              wildfly-archetypes/wildfly-subsystem-example at master · wildfly/wildfly-archetypes · GitHub

               

              describe handler should be registered only on root resource, and as follows

              registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE, false);

               

              and noting else for it is needed.

              1 of 1 people found this helpful