+ All Categories
Transcript
Page 1: Voodoo architecture

Voodoo Architecture

@mobileLarson @_openKnowledge

Lars Röwekamp | CIO New Technologies

Page 2: Voodoo architecture

„Fachlichkeit im Fokus!“ !

„Java EE 6 und 7 erlauben neben

Infrastructure Injection auch

Business Injection.“

Was sie mitnehmen sollten ...Voodoo powered Enterprise Architecture

Page 3: Voodoo architecture

Ok, was heißt das?

Page 4: Voodoo architecture

Voodoo powered

Call Center Anwendung !

‣ Kunde neu erfassen und speichern ‣ Call Center Agent als Audit Info mit speichern ‣ Begrüßungs-EMail an Neukunden versenden !

‣ Kunde löschen inkl. Sicherheitsabfrage ‣ Call Center Agent als Audit Info mit speichern ‣ EMail an ehemaligen Kunden versenden

Der Use CaseEnterprise Architecture

Page 5: Voodoo architecture

Old School

Page 6: Voodoo architecture

Voodoo powered

Use Case: Kunde neu erfassen !

‣ JSF View ruft UI Controller via U-EL ‣ UI Controller ruft CustomerService EJB ‣ UI Controller ruft MailService EJB

Enterprise ArchitectureOld School Ansatz

Page 7: Voodoo architecture

Voodoo powered Enterprise Architecture

Old School Ansatz

UI

Service

Data

JSF View

CreateCustomer

CustService MailService

Customer Mail

Page 8: Voodoo architecture

Enterprise ArchitectureOld School Ansatz

// JSF UI [email protected][email protected](name=“createCustomerController“)!public class CreateCustomerController {!! @EJB! private CustomerService customerService; !!

@EJB ! private MailService mailService; ! ! private Customer customer; !

! public String createCustomer() {!

customerService.create(customer); ! mailService.sendWelcomeMail(customer); ! return CUSTOMER_CREATED; !} !!// getter / setter for customer!...!

}!

Und was ist mit dem Call Center Agent?

Voodoo powered

Page 9: Voodoo architecture

Use Case: Kunde neu erfassen !

‣ JSF View ruft UI Controller via U-EL ‣ UI Controller ruft CustomerService EJB ‣ UI Controller ruft MailService EJB ‣ UI Controller ruft AuthenticationController

Enterprise ArchitectureOld School Ansatz

Voodoo powered

Page 10: Voodoo architecture

Enterprise ArchitectureOld School Ansatz

JSF View

CreateCustomer

CCAgent

AuthService

Mail

MailService

Customer

CustService

AuthController

Voodoo powered

Page 11: Voodoo architecture

Enterprise ArchitectureOld School Ansatz

// JSF UI [email protected][email protected](name=“createCustomerController“)!public class CreateCustomerController {!! // inject CustomerService and MailService via @EJB!!

@ManagedProperty(value=“#{authenticationController}“) ! private AuthenticationController authController; ! ...!

! public String createCustomer() {! CallCenterAgent currentCallCenterAgent;! currentCallCenterAgent = authController.getLoggedInUser(); !

customer.setAuditInformation(currentCallCenterAgent);! customerService.create(customer); ! mailService.sendWelcomeMail(customer); ! return CUSTOMER_CREATED;!} !!// getter / setter for customer!...!

}!

Ok, aber wo wird die Transaktion aufgezogen?

Voodoo powered

Page 12: Voodoo architecture

Use Case: Kunde neu erfassen !

‣ JSF View ruft UI Controller via U-EL ‣ UI Controller ruft AuthenticationController ‣ UI Controller ruft CustomerFacade EJB ‣ Delegate EJB ruft CustomerService EJB ‣ Delegate EJB ruft MailService EJB

Enterprise ArchitectureOld School Ansatz

Voodoo powered

Page 13: Voodoo architecture

TX

Enterprise ArchitectureOld School Ansatz

CreateCustomer

CustFacade

AuthService

CCAgent

CustService MailService

Customer Mail

AuthController

Voodoo powered

Page 14: Voodoo architecture

Enterprise ArchitectureOld School Ansatz

// JSF UI [email protected][email protected](name=“createCustomerController“)!public class CreateCustomerController {!!

@EJB ! private CustomerFacade customerFacade; !! @ManagedProperty(value=“#{authenticationController}“) ! private AuthenticationController authController; ! ! private Customer customer; !

! public String createCustomer() {! CallCenterAgent currentCallCenterAgent;! currentCallCenterAgent = authController.getLoggedInUser(); ! customerFacade.create(customer, currentCallCenterAgent); ! return CUSTOMER_CREATED;! } !

...!}

Voodoo powered

Page 15: Voodoo architecture

Enterprise ArchitectureOld School Ansatz

// EJB Service Facade!@Stateless!public class CustomerFacade {!! @EJB !

private CustomerService customerService!! @EJB!

private MailService mailService;!! // Transactional by default! public void createCustomer(Customer customer, ! CallCenterAgent currentCallCenterAgent) {!

customer.setAuditInformation(currentCallCenterAgent);! customerService.create(customer); ! mailService.sendWelcomeMail(customer); !} ! !...!

}

Fühlt sich nicht gut an! Alternativen sind aber

auch nicht viel schöner!

Voodoo powered

Page 16: Voodoo architecture

Enterprise ArchitectureOld School Ansatz

JSF View

CustService

CreateCustomer

AuthService

CCAgent

MailService

Customer Mail

AuthController

Voodoo powered

Page 17: Voodoo architecture

Use Case: Kunde löschen !

‣ JSF View ruft UI Controller via U-EL ‣ UI Controller „merkt“ sich Kunde in Session ‣ UI Controller navigiert zu Bestätigungsseite ‣ UI Controller bekommt Bestätigung ‣ UI Controller ruft CustomerService EJB ‣ ...

Enterprise ArchitectureOld School Ansatz

Voodoo powered

Page 18: Voodoo architecture

Enterprise ArchitectureOld School Ansatz

UI

Service

Data

JSF View 1

DeleteCustomer

CustService MailService

Customer Mail

JSF View 2

Voodoo powered

Page 19: Voodoo architecture

Enterprise ArchitectureOld School Ansatz

// JSF UI [email protected][email protected](name=“deleteCustomerController“)!public class DeleteCustomerController implements Serializable {!! // @EJB CustomerService, AuthenticationService and MailService!! private Customer customerToDelete;! ! public String askForDeletion(Customer customer) {! customerToDelete = customer; ! return SHOW_DELETE_CONFIRMATION; !

} !!

public String deleteCustomer() {! ... // call backend services and delete customer! return CUSTOMER_DELETED; !

} !...!

}! Wann kommt der Datensatz aus der Session wieder raus?

Voodoo powered

Page 20: Voodoo architecture

Problemkind Schichtenmodell !

‣ UI Controller via JSF Managed Beans ‣ Service Facade und Services via EJBs ‣ Persistenz via EntityManager und Entities !

‣ Alles nur Infrastruktur! ‣Wo steckt eigentlich die fachliche Domain?

Enterprise ArchitectureOld School Ansatz

Voodoo powered

Page 21: Voodoo architecture

Enterprise ArchitectureOld School Ansatz

UI

Service

Data

JSF View

@ManagedBean (JSF)

Session EJB Session EJB

EntityManager Entity

TX

Voodoo powered

Page 22: Voodoo architecture

Enterprise ArchitectureVoodoo Ansatz

UI

Domain

JSF View

UseCaseController

Business Object

Business Object

Business Object

TX

Voodoo powered

Page 23: Voodoo architecture

Enterprise ArchitectureVoodoo Ansatz

UI

Domain

JSF View

UseCaseController

Business Object

Business Object

Business Object

TX

Voodoo powered

Page 24: Voodoo architecture

Time for Voodoo …

Page 25: Voodoo architecture

Voodoo Steps: !

‣ „Technology Independence“ ‣ „@Inject Business Objects“ ‣ „No more EJBs for Transactions only“ ‣ „No more pumped up Sessions“ ‣ „No more Infrastructure in Views“ ‣ „No more doAll( ) Business Methods“

Enterprise ArchitectureMigration Guide

Voodoo powered

Page 26: Voodoo architecture

Voodoo Steps: !

‣ „Technology Independence“ ‣ „@Inject Business Objects“ ‣ „No more EJBs for Transactions only“ ‣ „No more pumped up Sessions“ ‣ „No more Infrastructure in Views“ ‣ „No more doAll( ) Business Methods“

Enterprise ArchitectureMigration Guide

Voodoo powered

Page 27: Voodoo architecture

// JSF UI [email protected][email protected](name=“createCustomerController“)!public class CreateCustomerController {!! // inject CustomerService and MailService via @EJB!!

@EJB ! private AuthenticationService authenticationService; ! ! private Customer customer; !

! public String createCustomer() {! currentCallCenterAgent = authenticationService.getLoggedInUser(); !

customer.setAuditInformation(currentCallCenterAgent);! customerService.create(customer); ! mailService.sendWelcomeMail(customer); ! return CUSTOMER_CREATED;!} !!// getter / setter for customer!...!

}!

Migration GuideTechnology Independence

Voodoo powered

Page 28: Voodoo architecture

// JSF UI [email protected][email protected](“createCustomerController“)!public class CreateCustomerController {!! // inject CustomerService and MailService via @Inject!!

@Inject! private AuthenticationService authenticationService; ! ! private Customer customer; !

! public String createCustomer() {! currentCallCenterAgent = authenticationService.getLoggedInUser(); !

customer.setAuditInformation(currentCallCenterAgent);! customerService.create(customer); ! mailService.sendWelcomeMail(customer); ! return CUSTOMER_CREATED;!} !!// getter / setter for customer!...!

}!

Migration GuideTechnology Independence

Voodoo powered

Page 29: Voodoo architecture

Voodoo Steps: !

‣ „Technology Independence“ ‣ „@Inject Business Objects“ ‣ „No more EJBs for Transactions only“ ‣ „No more pumped up Sessions“ ‣ „No more Infrastructure in Views“ ‣ „No more doAll( ) Business Methods“

Enterprise ArchitectureMigration Guide

Voodoo powered

Page 30: Voodoo architecture

CDI Producer Methods & Fields !

‣ Factory Method Pattern für Objekte ‣ @Producer als Mittel zum Zweck ‣ @Qualifier als Mittel zur Typ-Qualifizierung !

‣ ermöglicht fachliche Injektion

@Inject @Current CallCenterAgentMigration Guide

Voodoo powered

Page 31: Voodoo architecture

// JSF UI [email protected][email protected](“createCustomerController“)!public class CreateCustomerController {!! // inject CustomerService and MailService via @Inject!!

@Inject! private AuthenticationService authenticationService; ! ! private Customer customer; !

! public String createCustomer() {! currentCallCenterAgent = authenticationService.getLoggedInUser(); !

customer.setAuditInformation(currentCallCenterAgent);! customerService.create(customer); ! mailService.sendWelcomeMail(customer); ! return CUSTOMER_CREATED;!} !!// getter / setter for customer!...!

}!

Migration Guide@Inject @Current CallCenterAgent

Voodoo powered

Page 32: Voodoo architecture

// JSF UI [email protected][email protected](“createCustomerController“)!public class CreateCustomerController {!! // inject CustomerService and MailService via @Inject!!

@Inject @Current! private CallCenterAgent currentCallCenterAgent; ! ! private Customer customer; !

! public String createCustomer() {!

customer.setAuditInformation(currentCallCenterAgent);! customerService.create(customer); ! mailService.sendWelcomeMail(customer); ! return CUSTOMER_CREATED;!} !!// getter / setter for customer!...!

}!!

Migration Guide@Inject @Current CallCenterAgent

Voodoo powered

Page 33: Voodoo architecture

// Authentication Controller!@SessionScoped!@Named(“authenticationController“)!public class AuthenticationController implements Serializable {!!

private CallCenterAgent authenticatedCallCenterAgent; !! public String authenticate() {...}!!

@Produces @Current ! public CallCenterAgent getAuthenticatedCallCenterAgent() {!

return authenticatedCallCenterAgent;!} !!...!

}!!

Migration Guide@Inject @Current CallCenterAgent

@RequestScoped

@Inject @Current CallCenterAgent

Voodoo powered

Page 34: Voodoo architecture

package de.openknowldege.qualifier!!import ... !!// self-made qualifier to indicate current instance of something!!@Qualifier!@Target({TYPE, METHOD, PARAMETER, FIELD})!@Retention(RUNTIME)!public @interface Current{! !}

Migration Guide@Inject @Current CallCenterAgent

Voodoo powered

Page 35: Voodoo architecture

// JSF UI [email protected][email protected](“createCustomerController“)!public class CreateCustomerController {!! // inject CustomerService and MailService via @Inject!!

@Inject @Current! private CallCenterAgent currentCallCenterAgent; ! ! private Customer customer; !

! public String createCustomer() {!

customer.setAuditInformation(currentCallCenterAgent);! customerService.create(customer); ! mailService.sendWelcomeMail(customer); ! return CUSTOMER_CREATED;!} !!// getter / setter for customer!...!

}!!

Migration Guide@Inject @Current CallCenterAgent

Voodoo powered

Page 36: Voodoo architecture

// JSF UI [email protected][email protected](“createCustomerController“)!public class CreateCustomerController {!! // inject CustomerService and MailService via @Inject!!

@Inject @Current! private CallCenterAgent currentCallCenterAgent; ! ! private Customer customer; !

! public String createCustomer() {!

customer.setAuditInformation(currentCallCenterAgent);! customerService.create(customer); ! mailService.sendWelcomeMail(customer); ! return CUSTOMER_CREATED;!} !!// getter / setter for customer!...!

}!!

Migration Guide@Inject @Current CallCenterAgent

Voodoo powered

Page 37: Voodoo architecture

// Customer Service EJB!@Stateless!public class CustomerService {!!

@Inject @Current! private CallCenterAgent currentCallCenterAgent; ! ! @PersistenceContext ! private EntityManager em; !

! // transactional by default ! public void createCustomer(Customer customer) {!

customer.setAuditInformation(currentCallCenterAgent); ! em.persist(customer);!} !!...!

}!!

Migration Guide@Inject @Current CallCenterAgent

Voodoo powered

Page 38: Voodoo architecture

Voodoo Steps: !

‣ „Technology Independence“ ‣ „@Inject Business Objects“ ‣ „No more EJBs for Transactions only“ ‣ „No more pumped up Sessions“ ‣ „No more Infrastructure in Views“ ‣ „No more doAll( ) Business Methods“

Enterprise ArchitectureMigration Guide

Voodoo powered

Page 39: Voodoo architecture

Injizierbare CDI Ressourcen !

‣ normale Java Klassen - optional mit @Named und/oder @Qualifier markiert ‣ EJBs - Stateless, Stateful, Singleton ‣ sonstige Java EE Resources -

UserTransaction, PersistenceContext, ...

No more EJBsMigration Guide

Voodoo powered

Page 40: Voodoo architecture

// Customer Service EJB !@Stateless!public class CustomerService {!!

@Inject @Current! private CallCenterAgent currentCallCenterAgent; ! ! @PersistenceContext ! private EntityManager em; !

! // transactional by default ! public void createCustomer(Customer customer) {!

customer.setAuditInformation(currentCallCenterAgent); ! em.persist(customer);!} !!...!

}!!

Migration GuideNo more EJBs

Voodoo powered

Page 41: Voodoo architecture

// Customer Service EJB - no annotation required!!@Stateless!public class CustomerService {!!

@Inject @Current! private CallCenterAgent currentCallCenterAgent; ! ! @PersistenceContext ! private EntityManager em; !

! // transactional by default ! public void createCustomer(Customer customer) {!

customer.setAuditInformation(currentCallCenterAgent); ! em.persist(customer);!} !!...!

}!!

Migration Guide

Ok, aber wo bekommen wie die Transaktion jetzt her?

No more EJBsVoodoo powered

Page 42: Voodoo architecture

// Customer Service EJB - no annotation required!!@Stateless!public class CustomerService {!!

@Inject @Current! private CallCenterAgent currentCallCenterAgent; ! ! @PersistenceContext ! private EntityManager em; !

! @Transactional ! public void createCustomer(Customer customer) {!

customer.setAuditInformation(currentCallCenterAgent); ! em.persist(customer);!} !!...!

}!!

Migration Guide

JTA 1.2 oder DeltaSpike oder als Self-Made CDI-Interceptor

No more EJBsVoodoo powered

Page 43: Voodoo architecture

!@InterceptorBinding!@Target({TYPE, METHOD})!@Retention(RUNTIME)!public @interface Transactional {!!

@Nonbinding! public TransactionalType value() !

default TransactionalType.REQUIRED; ! !

}!!

Migration GuideNo more EJBs

Voodoo powered

Page 44: Voodoo architecture

!@Transactional !@Interceptor!public class TransactionAdvice {!! @Inject! private UserTransaction utx;!! @AroundInvoke! public Object applyTransaction(! InvocationContext ic) throws Throwable {!! ... // 1. implement utx.begin()! ic.proceed(); // 2. call original method! ... // 3. implement utx.commit()!! } !

Migration GuideNo more EJBs

*XML registration omitted

Voodoo powered

Page 45: Voodoo architecture

// Customer Service - no annotation required!!public class CustomerService {!!

@Inject @Current! private CallCenterAgent currentCallCenterAgent; ! ! @PersistenceContext ! private EntityManager em; !

! @Transactional ! public void createCustomer(Customer customer) {!

customer.setAuditInformation(currentCallCenterAgent); ! em.persist(customer);!} !!...!

}!!

Migration GuideNo more EJBs

Voodoo powered

Page 46: Voodoo architecture

Migration Guide

UI

Service

Data

JSF View

UsecaseController

Service Service

EntityManager Entity

TX

No more EJBsVoodoo powered

Page 47: Voodoo architecture

Migration Guide

UI

Service

Data

JSF View

UsecaseController

Service Service

EntityManager Entity

TX

No more EJBsVoodoo powered

Page 48: Voodoo architecture

// JSF UI [email protected][email protected](“createCustomerController“)!public class CreateCustomerController {!! @Inject! private CustomerService customerService;!

! private Customer customer; !

! @Transactional! public String createCustomer() {!

customerService.create(customer); ! ... // some additional use case “tx“ related work! return CUSTOMER_CREATED;!} !!// getter / setter for customer!...!

}!!

Migration GuideNo more EJBs

Voodoo powered

Page 49: Voodoo architecture

Voodoo Steps: !

‣ „Technology Independence“ ‣ „@Inject Business Objects“ ‣ „No more EJBs for Transactions only“ ‣ „No more pumped up Sessions“ ‣ „No more Infrastructure in Views“ ‣ „No more doAll( ) Business Methods“

Enterprise ArchitectureMigration Guide

Voodoo powered

Page 50: Voodoo architecture

Anti-Pattern „alles in die Session“ !

‣ RequestScoped ist leider zu kurz ‣ ViewScoped irgendwie auch und „JSF only“ ‣ SessionScoped aus Mangel an Alternativen

No more pumped up SessionMigration Guide

‣ ViewScoped ab Java EE 7 auch als „CDI“ ‣ FlowScoped ab Java EE 7

Voodoo powered

Page 51: Voodoo architecture

Migration GuideNo more pumped up Session

// JSF UI [email protected][email protected](“deleteCustomerController“)!public class DeleteCustomerController implements Serializable {!! // @EJB CustomerService, AuthenticationService and MailService!! private Customer customerToDelete;! ! public String askForDeletion(Customer customer) {! customerToDelete = customer; ! return SHOW_DELETE_CONFIRMATION; !

} !!

public String deleteCustomer(Customer customer) {! ... // call backend services! return CUSTOMER_DELETED; !

} !...!

}!

Voodoo powered

Page 52: Voodoo architecture

Migration GuideNo more pumped up Session

// JSF UI [email protected][email protected](“deleteCustomerController“)!public class DeleteCustomerController implements Serializable {!!

private Customer customerToDelete;!! @Inject! private Conversation conversation; ! ! public String askForDeletion(Customer customer) {! conversation.begin();! customerToDelete = customer; ! return SHOW_DELETE_CONFIRMATION; !

} !!

public String deleteCustomer(Customer customer) {! conversation.end();!

... // call backend services! return CUSTOMER_DELETED; !

} !...!

}!

Was ist, wenn schon aktiv?

Was ist, wenn nicht aktiv?

Voodoo powered

Page 53: Voodoo architecture

Voodoo Steps: !

‣ „Technology Independence“ ‣ „@Inject Business Objects“ ‣ „No more EJBs for Transactions only“ ‣ „No more pumped up Sessions“ ‣ „No more Infrastructure in Views“ ‣ „No more doAll( ) Business Methods“

Enterprise ArchitectureMigration Guide

Voodoo powered

Page 54: Voodoo architecture

Views sind nach wie vor ein Problem !

‣ Injection via U-EL ‣ Injection von UI Controllern

No more Infrastructure in ViewsMigration Guide

Voodoo powered

Page 55: Voodoo architecture

Migration Guide

<html ...>! <h:body>! <h:form>!! Vorname: <h:inputText ! value=“#{createCustomerController.customer.firstname}"/>! Name: <h:inputText ! value=“#{createCustomerController.customer.lastname}"/> ! !! </h:form>! </h:body>!</html>!

No more Infrastructure in Views

Infrastruktur in der View

Voodoo powered

Page 56: Voodoo architecture

Migration Guide

<html ...>! <h:body>! <h:form>!! Vorname: <h:inputText ! value=“#{customerToCreate.firstname}"/>! Name: <h:inputText ! value=“#{customerToCreate.lastname}"/> ! !! </h:form>! </h:body>!</html>!

No more Infrastructure in Views

Fachlichkeit in der View

Voodoo powered

Page 57: Voodoo architecture

// JSF UI [email protected][email protected](“createCustomerController“)!public class CreateCustomerController {!! @Inject! private CustomerService customerService;!

! private Customer customer; ! !

// getter for [email protected][email protected](“customerToCreate“) !public Customer getCustomer {! return customer; !}!...!

}!!

Migration GuideNo more Infrastructure in Views

Voodoo powered

Page 58: Voodoo architecture

Voodoo Steps: !

‣ „Technology Independence“ ‣ @Inject Business Objects ‣ „No more EJBs for Transactions only“ ‣ „No more pumped up Sessions“ ‣ „No more Infrastructure in Views“ ‣ „No more doAll( ) Business Methods“

Enterprise ArchitectureMigration Guide

Voodoo powered

Page 59: Voodoo architecture

Ein Use Case kommt selten allein !

‣ Primärer Use Case - Create Customer !

‣ Sekundärer Use Case - Send Welcome Mail ‣ Sekundärer Use Case - Für Mandant X ... ‣ Sekundärer Use Case - ...

No more doAll() Business MethodsMigration Guide

Voodoo powered

Page 60: Voodoo architecture

CDI Events zur losen Kopplung, d.h Java EE Observer Patten inkl. ... !

‣ Event Object & Event Producer ‣ Observer Method !

‣ schichtenneutral für POJOs ‣ ggf. transaktionsgebunden ‣ synchrone Interaktion

No more doAll() Business MethodsMigration Guide

Voodoo powered

Page 61: Voodoo architecture

Migration Guide

Event/Message Producer

CDI Bean Manager

Observer Method

Observer Method

Observer Method

No more doAll() Business Methods

USER CREATED

interessant

ok, danke

gut zu wissen

Voodoo powered

Page 62: Voodoo architecture

OK, CDI Events - klingt super, aber ... !

‣Wie sieht ein solches Event aus? ‣ Und wie fange ich es ab?

!

‣ Und vor allem: Wie löse ich es aus?

No more doAll() Business MethodsMigration Guide

Voodoo powered

Page 63: Voodoo architecture

// JSF UI [email protected][email protected](“createCustomerController“)!public class CreateCustomerController {!! @Inject! private CustomerService customerService;!! @Inject @Created! private Event<Customer> eventSource;!

! private Customer customer; !

! @Transactional! public String createCustomer() {!

customerService.create(customer); ! eventSource.fire(customer);! return CUSTOMER_CREATED;!} !...!

}!

Migration GuideNo more doAll() Business Methods

Voodoo powered

Page 64: Voodoo architecture

Migration Guide

@ApplicationScoped!public class MailService implements Serializable {!! public void sendWelcomeMail(! @Observes! @Created Customer customer) { ! ! // do some work with the customer object! ! ...! }!! ...!}!

‣Wie fange ich es?

No more doAll() Business Methods

Wow! Geht da noch mehr?

Voodoo powered

Page 65: Voodoo architecture

Migration Guide

@ApplicationScoped!public class MailService implements Serializable {!! public void sendWelcomeMail(! @Observes @TenantId(“4711“)! @Created Customer customer) { ! ! // do some work with the customer object for tenant 4711! ! ...! }!! ...!}!

‣Wie fange ich es?

No more doAll() Business MethodsVoodoo powered

Page 66: Voodoo architecture

Migration Guide

@ApplicationScoped!public class MailService implements Serializable {!! // Conditional Observer Method that takes ! // - Transaction status, e.g. AFTER_SUCCESS, AFTER_FAILURE! // - Bean instance status, e.g. ALLWAYS! // into account! public void sendWelcomeMail(! @Observes( ! receive=ALLWAYS, // bean ! during=AFTER_SUCCESS // tx ! ) ! @Created Customer customer) { !

... ! }!}!!

‣ Conditional Observer

No more doAll() Business MethodsVoodoo powered

Page 67: Voodoo architecture

Enterprise ArchitectureVoodoo Ansatz

UI

Domain

JSF View

UseCaseController

Business Object

Business Object

Business Object

TX

Voodoo powered

Page 68: Voodoo architecture

Enterprise ArchitectureVoodoo Ansatz

UI

Domain

JSF View

UseCaseController

Business Object

Business Object

Business Object

TX

Voodoo powered

Page 69: Voodoo architecture

New School Enterprise Architecture !

‣mit CDI !

‣ typensicher ‣ schichtenneutral ‣ fachliche und technologische Injection ‣ eventgetriebene Entwicklung

FazitEnterprise Architecture

Voodoo powered

Page 70: Voodoo architecture

Voodoo Architecture

@mobileLarson @_openKnowledge

Lars Röwekamp | CIO New Technologies


Top Related