Interface Topic<T>

  • Type Parameters:
    T - The type of event to be distributed to subscribers
    All Known Implementing Classes:
    TopicImpl

    public interface Topic<T>
    This service is used for publishing events to subscribers. The type of the Topic is the type of event that will be distributed
    Author:
    jwells
    • Method Detail

      • publish

        void publish​(T message)
        Publishes a message to all subscribers
        Parameters:
        message - The non-null message to send to all current subscribers
        Throws:
        IllegalStateException - If there is no implementation of TopicDistributionService to do the distribution of the message
      • named

        Topic<T> named​(String name)
        Returns an Topic that is further qualified with the given name
        Parameters:
        name - The value field of the Named annotation parameter. Must not be null
        Returns:
        A topic further qualified with the given name
      • ofType

        <U> Topic<U> ofType​(Type type)
        Returns an Topic that is of the given type. This type must be more specific than the type of this Topic
        Parameters:
        type - The type to restrict the returned Topic to
        Returns:
        A Topic restricted to only producing messages of the given type
      • qualifiedWith

        Topic<T> qualifiedWith​(Annotation... qualifiers)
        A set of qualifiers to further restrict this Topic to.
        Parameters:
        qualifiers - The qualifiers to further restrict this Topic to
        Returns:
        An Topic restricted with the given qualifiers
      • getTopicType

        Type getTopicType()
        Gets the type of the topic, in order to match the message to subscribers
        Returns:
        the Type of this topic. Will not return null
      • getTopicQualifiers

        Set<Annotation> getTopicQualifiers()
        The qualifiers associated with this Topic. Messages should only be distributed to subscribers that have matching qualifiers
        Returns:
        the non-null but possibly empty set of qualifiers associated with this Topic