Class SocketProductReceiver

  • All Implemented Interfaces:
    NotificationIndexCleanup.Listener, NotificationReceiver, Configurable, SocketListenerInterface

    public class SocketProductReceiver
    extends DefaultNotificationReceiver
    implements SocketListenerInterface
    Receive Products directly via a Socket. The received products are sent using a SocketProductSender. A SocketProductReceiver receives products directly and notifies listeners of received notifications. These are typically used on hubs with an EIDSNotificationSender or RelayProductReceiver. The NotificationReceiver uses a NotificationIndex to track received notifications, and a ProductStorage to store retrieved products. The DefaultNotificationReceiver implements the Configurable interface and uses the following configuration parameters: Each listener has a separate queue of notifications. Each listener is allocated one thread to process notifications from this queue.
    • Constructor Detail

      • SocketProductReceiver

        public SocketProductReceiver()
                              throws java.lang.Exception
        Default constructor setting port, threads, and sizeLimit to default
        Throws:
        java.lang.Exception - if error occurs
      • SocketProductReceiver

        public SocketProductReceiver​(Config config)
                              throws java.lang.Exception
        Constructor based on config file
        Parameters:
        config - Configuration file
        Throws:
        java.lang.Exception - if error occurs
    • Method Detail

      • configure

        public void configure​(Config config)
                       throws java.lang.Exception
        Description copied from class: DefaultConfigurable
        Process configuration settings. Called before startup().
        Specified by:
        configure in interface Configurable
        Overrides:
        configure in class DefaultNotificationReceiver
        Parameters:
        config - the Config object with settings.
        Throws:
        java.lang.Exception - if configuration exceptions occur.
      • storeAndNotify

        protected java.lang.String storeAndNotify​(ProductSource source)
                                           throws java.lang.Exception
        Stores ProductSource as a notification, tracks it, and notifies Listeners
        Parameters:
        source - ProductSource
        Returns:
        String note for log file
        Throws:
        java.lang.Exception - if error occurs
      • getPort

        public int getPort()
        Returns:
        port
      • setPort

        public void setPort​(int port)
        Parameters:
        port - int to set
      • getSizeLimit

        public long getSizeLimit()
        Returns:
        sizeLimit
      • setSizeLimit

        public void setSizeLimit​(long sizeLimit)
        Parameters:
        sizeLimit - long to set
      • getThreads

        public int getThreads()
        Returns:
        threads
      • setThreads

        public void setThreads​(int threads)
        Parameters:
        threads - int to set