Class ServiceDispatcher

java.lang.Object
org.frankframework.receivers.ServiceDispatcher

public class ServiceDispatcher extends Object
Singleton class that knows about the ServiceListeners that are active.
This class is to be used as a facade for different services that implement the ServiceClient interface.
This class is exposed as a webservice, to be able to provide a single point of entry to all adapters that have a ServiceListener as a IReceiver.
Author:
Johan Verrips, Niels Meijer
See Also:
  • Field Details

    • log

      protected org.apache.logging.log4j.Logger log
  • Constructor Details

    • ServiceDispatcher

      public ServiceDispatcher()
  • Method Details

    • getInstance

      public static ServiceDispatcher getInstance()
      Use this method to get hold of the ServiceDispatcher
      Returns:
      an instance of this class
    • dispatchRequest

      public Message dispatchRequest(String serviceName, Message message, PipeLineSession session) throws ListenerException
      Dispatch a request Message to a service by its configured name.
      Parameters:
      serviceName - ServiceName given to the ServiceClient implementation that is to be called
      message - Message to be processed
      session - Existing PipeLineSession.
      Returns:
      Message with the result of the requested adapter execution.
      Throws:
      ListenerException - If there was an error in request execution.
    • getRegisteredListenerNames

      public SortedSet<String> getRegisteredListenerNames()
      Retrieve the names of the registered listeners in alphabetical order.
      Returns:
      Set with the names.
    • isRegisteredServiceListener

      public boolean isRegisteredServiceListener(String name)
      Check whether a serviceName is registered at the ServiceDispatcher.
      Returns:
      true if the service is registered at this dispatcher, otherwise false
    • registerServiceClient

      public void registerServiceClient(String name, ServiceClient listener)
    • unregisterServiceClient

      public void unregisterServiceClient(String name)
    • getListener

      public ServiceClient getListener(String name)