Class QueryResolverImpl
- java.lang.Object
-
- de.quantummaid.eventmaid.qcec.queryresolving.QueryResolverImpl
-
- All Implemented Interfaces:
QueryResolver
public class QueryResolverImpl extends Object implements QueryResolver
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Query<?>>
SubscriptionIdanswer(Class<T> queryClass, Consumer<T> responder)Adds a newConsumerasSubscriberforthe givenQueryclass.<R> Optional<R>query(Query<R> query)Sends theQueryto all interestedSubscribers.<R> RqueryRequired(Query<R> query)Sends theQueryto all interestedSubscribers.voidunsubscribe(SubscriptionId subscriptionId)Method to remove allConsumermatching theSubscriptionId.
-
-
-
Method Detail
-
answer
public <T extends Query<?>> SubscriptionId answer(Class<T> queryClass, Consumer<T> responder)
Description copied from interface:QueryResolverAdds a newConsumerasSubscriberforthe givenQueryclass.- Specified by:
answerin interfaceQueryResolver- Type Parameters:
T- the type of the query- Parameters:
queryClass- the class of theQueryresponder- theConsumerto answer the query- Returns:
- a
SubscriptionIdof theSubscriber
-
query
public <R> Optional<R> query(Query<R> query)
Description copied from interface:QueryResolverSends theQueryto all interestedSubscribers. This method does not need to return an result.- Specified by:
queryin interfaceQueryResolver- Type Parameters:
R- the type of the result- Parameters:
query- theQueryto be sent- Returns:
- an
Optionalfor theQueryresult
-
queryRequired
public <R> R queryRequired(Query<R> query)
Description copied from interface:QueryResolverSends theQueryto all interestedSubscribers. This method expects a valid result.- Specified by:
queryRequiredin interfaceQueryResolver- Type Parameters:
R- the type of the result- Parameters:
query- theQueryto be sent- Returns:
- the
Queryresult
-
unsubscribe
public void unsubscribe(SubscriptionId subscriptionId)
Description copied from interface:QueryResolverMethod to remove allConsumermatching theSubscriptionId.- Specified by:
unsubscribein interfaceQueryResolver- Parameters:
subscriptionId- theSubscriptionIdto remove
-
-