You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/03/20 23:03:39 UTC
svn commit: r1579781 -
/isis/site/trunk/content/reference/services/event-bus-service.md
Author: danhaywood
Date: Thu Mar 20 22:03:39 2014
New Revision: 1579781
URL: http://svn.apache.org/r1579781
Log:
event bus service
Modified:
isis/site/trunk/content/reference/services/event-bus-service.md
Modified: isis/site/trunk/content/reference/services/event-bus-service.md
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/reference/services/event-bus-service.md?rev=1579781&r1=1579780&r2=1579781&view=diff
==============================================================================
--- isis/site/trunk/content/reference/services/event-bus-service.md (original)
+++ isis/site/trunk/content/reference/services/event-bus-service.md Thu Mar 20 22:03:39 2014
@@ -24,14 +24,6 @@ where
## Usage
-A good practice for domain services is to self-register when the `EventBusService` is injected into it:
-
- private EventBusService eventBusService;
- public void injectEventBusService(final EventBusService eventBusService) {
- this.eventBusService = eventBusService;
- eventBusService.register(this);
- }
-
The actual subscription of events is done by annotating a method on the class (that is, the usual Guava programming model).
For example, suppose in a library domain that a `LibraryMember` wants to leave the library. A letter should be sent out detailing any books that they still have out on loan:
@@ -64,6 +56,16 @@ Meanwhile, in the `BookRepository` domai
This design allows the `libraryMember` module to be decoupled from the `book` module.
+### Self Registration
+
+A good practice for domain services is to self-register when the `EventBusService` is injected into it:
+
+ private EventBusService eventBusService;
+ public void injectEventBusService(final EventBusService eventBusService) {
+ this.eventBusService = eventBusService;
+ eventBusService.register(this);
+ }
+
### `@PostsPropertyChangedEvent`