Class BroadcastAndListen

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.SizeOfHandler, adams.core.Stoppable, adams.core.StoppableWithFeedback, adams.flow.core.FlowContextHandler, Serializable

    public class BroadcastAndListen
    extends AbstractRedisAction
    Broadcasts the incoming data to the specified out channel and listens for data to come through on the in channel.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_ChannelOut

        protected String m_ChannelOut
        the channel for sending data.
      • m_TypeOut

        protected RedisDataType m_TypeOut
        the data type for the out channel.
      • m_ChannelIn

        protected String m_ChannelIn
        the channel for receiving data.
      • m_TypeIn

        protected RedisDataType m_TypeIn
        the data type for the incoming channel.
      • m_TimeOut

        protected int m_TimeOut
        the timeout in msec.
      • m_PubSubConnection

        protected transient io.lettuce.core.pubsub.StatefulRedisPubSubConnection m_PubSubConnection
        the pub/sub connection object.
      • m_PubSubListener

        protected transient io.lettuce.core.pubsub.RedisPubSubListener m_PubSubListener
        the pub/sub listener.
      • m_Data

        protected transient Object m_Data
        the received data.
    • Constructor Detail

      • BroadcastAndListen

        public BroadcastAndListen()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • setChannelOut

        public void setChannelOut​(String value)
        Sets the channel for sending data.
        Parameters:
        value - the channel
      • getChannelOut

        public String getChannelOut()
        Returns the channel for sending data.
        Returns:
        the channel
      • channelOutTipText

        public String channelOutTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setTypeOut

        public void setTypeOut​(RedisDataType value)
        Sets the type of the data for the out channel.
        Parameters:
        value - the type
      • getTypeOut

        public RedisDataType getTypeOut()
        Returns the type of the data for the out channel.
        Returns:
        the type
      • typeOutTipText

        public String typeOutTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setChannelIn

        public void setChannelIn​(String value)
        Sets the channel for receiving data.
        Parameters:
        value - the channel
      • getChannelIn

        public String getChannelIn()
        Returns the channel for receiving data.
        Returns:
        the channel
      • channelInTipText

        public String channelInTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setTypeIn

        public void setTypeIn​(RedisDataType value)
        Sets the type of the data for the in channel.
        Parameters:
        value - the type
      • getTypeIn

        public RedisDataType getTypeIn()
        Returns the type of the data for the in channel.
        Returns:
        the type
      • typeInTipText

        public String typeInTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setTimeOut

        public void setTimeOut​(int value)
        Sets the timeout in msec.
        Parameters:
        value - the timeout
      • getTimeOut

        public int getTimeOut()
        Returns the timeout in msec.
        Returns:
        the timeout
      • timeOutTipText

        public String timeOutTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Overrides:
        getQuickInfo in class AbstractRedisAction
        Returns:
        null if no info available, otherwise short string
      • accepts

        public Class[] accepts()
        Returns the classes the action accepts as input.
        Specified by:
        accepts in class AbstractRedisAction
        Returns:
        the classes
      • generates

        public Class generates()
        Returns the classes the action generates as output.
        Specified by:
        generates in class AbstractRedisAction
        Returns:
        the classes
      • newStringListener

        protected io.lettuce.core.pubsub.RedisPubSubListener<String,​String> newStringListener()
        Returns a new pub/sub listener for strings.
        Returns:
        the listener
      • newBytesListener

        protected io.lettuce.core.pubsub.RedisPubSubListener<byte[],​byte[]> newBytesListener()
        Returns a new pub/sub listener for byte arrays.
        Returns:
        the listener
      • doExecute

        protected Object doExecute​(RedisConnection connection,
                                   Object o,
                                   adams.core.MessageCollection errors)
        Performs the action.
        Specified by:
        doExecute in class AbstractRedisAction
        Parameters:
        connection - the Redis connection
        o - the object to process
        errors - for collecting errors
        Returns:
        the generated object