We are designing a system which mimics a BPEL application with sets of functional requirements such as bulk messaging, managing SLAs, error handling and so on.

One of the intentions is to modularize these functional and non-functional aspects into separate web apps so that we can choose at build time and plug them all together.

How does one go about designing this app - choosing design patterns for a controlling framework that delegates between the modules?

Put another way - it's like the chain of activities in an ESB, so the controller passes on to A then B then C. In other cases it goes A > B > D and so on.

So my question: what design pattern does this controller have? How can it decide the logic of whether at the end of A, should it call B or C

1 Answer 1



You have "macro" commands, which consist of other commands.

class Command { 
    public abstract void execute()
class MacroCommand extends Command {
    List<Command> body;
    public void append( Command aCommand ) { body.add(aCommand); }
class A extends Command {...}
class B extends Command {...}
class A_B extends MacroCommand {
    public A_B() { append(new A()); append(new B()); }
  • If my controller is A_B of your example, how would I make it conditional , i.e. do B if A succeeds and so on Jun 24, 2011 at 10:00
  • @shinynewbike: Use if statements. A MacroCommand is the easy way to have an unconditional sequence. If you want "code"-style BPEL, you have to write actual code. There's no magical way to have code-like behavior without simply writing code. A Command can (trivially) depend on other Commands without being a simplistic MacroCommand.
    – S.Lott
    Jun 24, 2011 at 10:03
  • @shinynewbike You could do something similar in concept to Linux pipes. Clearly put, output from each Command could be passed to an object which can control the flow (do nothing, skip, goto, abort...).
    – James P.
    Jul 14, 2012 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.