Class DocumentBusImpl

    • Constructor Detail

      • DocumentBusImpl

        public DocumentBusImpl()
    • Method Detail

      • answer

        public <T extends Query<?>> AnswerStep1Builder<T> answer​(Class<T> queryClass)
        Description copied from interface: DocumentBus
        Entry point of the defining process, how and when to answer a Query.
        Specified by:
        answer in interface DocumentBus
        Type Parameters:
        T - the type of the Query
        Parameters:
        queryClass - the class of the Query to answer
        Returns:
        a builder to define further aspects of the answer
      • ensure

        public <T> AnswerStep1Builder<T> ensure​(Class<T> constraintClass)
        Description copied from interface: DocumentBus
        Entry point of the defining process, how and when to enforce a constraint.
        Specified by:
        ensure in interface DocumentBus
        Type Parameters:
        T - the type of the constraint
        Parameters:
        constraintClass - the class of the constraint to enforce
        Returns:
        a builder to define further aspects of the enforcement
      • reactTo

        public <T> AnswerStep1Builder<T> reactTo​(Class<T> eventClass)
        Description copied from interface: DocumentBus
        Entry point of the defining process, how an when to react to an event.
        Specified by:
        reactTo in interface DocumentBus
        Type Parameters:
        T - the type of the event
        Parameters:
        eventClass - the class of the event to react to
        Returns:
        a builder to define further aspects of the reactin
      • query

        public <T> Optional<T> query​(Query<T> query)
        Description copied from interface: DocumentBus
        Executes the Query.
        Specified by:
        query in interface DocumentBus
        Type Parameters:
        T - the type of the Query
        Parameters:
        query - the Query to execute
        Returns:
        an Optional containing the result
      • queryRequired

        public <T> T queryRequired​(Query<T> query)
        Description copied from interface: DocumentBus
        Executes the Query and expects a result.
        Specified by:
        queryRequired in interface DocumentBus
        Type Parameters:
        T - the type of the Query
        Parameters:
        query - the Query to execute
        Returns:
        the result of the query
      • enforce

        public void enforce​(Object constraint)
        Description copied from interface: DocumentBus
        Enforces to given constraint.
        Specified by:
        enforce in interface DocumentBus
        Parameters:
        constraint - the constraint to enforce
      • publish

        public void publish​(Object event)
        Description copied from interface: DocumentBus
        Publishes the given event.
        Specified by:
        publish in interface DocumentBus
        Parameters:
        event - the event to publish
      • unsubscribe

        public void unsubscribe​(SubscriptionId subscriptionId)
        Description copied from interface: DocumentBus
        Removes the subscription for the given SubscriptionId independent of whether it was for a Query, a constraint or an event.
        Specified by:
        unsubscribe in interface DocumentBus
        Parameters:
        subscriptionId - the SubscriptionId to remove