Class ExampleService

  • All Implemented Interfaces:
    MessageReceiver, EventListener, ConfigListener

    @Service(name="example-service")
    @RunLevel(10)
    public class ExampleService
    extends Object
    implements EventListener, MessageReceiver, ConfigListener
    An example of a service which can be used as an aid to developing future services The service implements Event Listener to hook into the Sever wide events system The service implements MessageReceiver to hook into the cluster wide messaging system The service implements ConfigListener to receive notifications if it's configuration changes Note you do not need to inject all the services below they are just examples of what is available Note if you need to respond to configuration changes and be dynamic then implement the ConfigListener interface if you are unable to respond to config changes don't implement the interface.
    Author:
    steve
    • Constructor Detail

      • ExampleService

        public ExampleService()
    • Method Detail

      • bootService

        @PostConstruct
        public void bootService()
        This method is called after the service instance has been created
      • event

        public void event​(EventListener.Event event)
        This is the required method for the EventListener interface for server wide messages handling these events means your service can take action depending on things happening within the server
        Specified by:
        event in interface EventListener
        Parameters:
        event -
      • receiveMessage

        public void receiveMessage​(ClusterMessage message)
        This is the required method for the Payara Specific cluster wide event bus
        Specified by:
        receiveMessage in interface MessageReceiver
        Parameters:
        message -
      • reconfigure

        public void reconfigure()
      • doSomethingDirectly

        public void doSomethingDirectly​(String message)
        Example method to be used by the instance targeted asadmin command to interact with the service directly