Class DocumentBusImpl
- java.lang.Object
-
- de.quantummaid.eventmaid.qcec.domainBus.DocumentBusImpl
-
- All Implemented Interfaces:
DocumentBus,AnswerRegister
public class DocumentBusImpl extends Object implements DocumentBus, AnswerRegister
-
-
Constructor Summary
Constructors Constructor Description DocumentBusImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Query<?>>
AnswerStep1Builder<T>answer(Class<T> queryClass)Entry point of the defining process, how and when to answer aQuery.voidenforce(Object constraint)Enforces to given constraint.<T> AnswerStep1Builder<T>ensure(Class<T> constraintClass)Entry point of the defining process, how and when to enforce a constraint.voidpublish(Object event)Publishes the given event.<T> Optional<T>query(Query<T> query)Executes theQuery.<T> TqueryRequired(Query<T> query)Executes theQueryand expects a result.<T> AnswerStep1Builder<T>reactTo(Class<T> eventClass)Entry point of the defining process, how an when to react to an event.SubscriptionIdsubmit(Answer answer)voidunsubscribe(SubscriptionId subscriptionId)Removes the subscription for the givenSubscriptionIdindependent of whether it was for aQuery, a constraint or an event.
-
-
-
Method Detail
-
answer
public <T extends Query<?>> AnswerStep1Builder<T> answer(Class<T> queryClass)
Description copied from interface:DocumentBusEntry point of the defining process, how and when to answer aQuery.- Specified by:
answerin interfaceDocumentBus- Type Parameters:
T- the type of theQuery- Parameters:
queryClass- the class of theQueryto answer- Returns:
- a builder to define further aspects of the answer
-
ensure
public <T> AnswerStep1Builder<T> ensure(Class<T> constraintClass)
Description copied from interface:DocumentBusEntry point of the defining process, how and when to enforce a constraint.- Specified by:
ensurein interfaceDocumentBus- 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:DocumentBusEntry point of the defining process, how an when to react to an event.- Specified by:
reactToin interfaceDocumentBus- 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:DocumentBusExecutes theQuery.- Specified by:
queryin interfaceDocumentBus- Type Parameters:
T- the type of theQuery- Parameters:
query- theQueryto execute- Returns:
- an
Optionalcontaining the result
-
queryRequired
public <T> T queryRequired(Query<T> query)
Description copied from interface:DocumentBusExecutes theQueryand expects a result.- Specified by:
queryRequiredin interfaceDocumentBus- Type Parameters:
T- the type of theQuery- Parameters:
query- theQueryto execute- Returns:
- the result of the query
-
enforce
public void enforce(Object constraint)
Description copied from interface:DocumentBusEnforces to given constraint.- Specified by:
enforcein interfaceDocumentBus- Parameters:
constraint- the constraint to enforce
-
publish
public void publish(Object event)
Description copied from interface:DocumentBusPublishes the given event.- Specified by:
publishin interfaceDocumentBus- Parameters:
event- the event to publish
-
submit
public SubscriptionId submit(Answer answer)
- Specified by:
submitin interfaceAnswerRegister
-
unsubscribe
public void unsubscribe(SubscriptionId subscriptionId)
Description copied from interface:DocumentBusRemoves the subscription for the givenSubscriptionIdindependent of whether it was for aQuery, a constraint or an event.- Specified by:
unsubscribein interfaceDocumentBus- Parameters:
subscriptionId- theSubscriptionIdto remove
-
-