At a recent presentation, a colleague asked me, "Can a composite service be implemented in an ESB?"
As I've previously discussed, a composite service is one whose implementation calls other services. It acts as both a provider of the (composite) service and a consumer of child services.
As a consumer of services, a composite service can certainly live outside of an ESB and use the ESB to invoke its child services. As discussed in ESB and Workflow, if a composite service is a business process, it must live outside of the ESB since an ESB is generally not thought of as including a process engine.
So what if a composite service is not a business process? Can it be implemented in an ESB? The question is: If a composite service were implemented in an ESB, how would it be implemented?
An ESB can contain integration logic implemented as mediations, mediation flows built from mediation primitives. Mediation flows usually (always?) run in a single transaction and are stateless. Thus it would be difficult to implement a mediation primitive for invoking a service, especially a general-purpose primitive that could be configured for any service.
Thus in general, I think you're better off implementing composite services external to an ESB. A composite service is a consumer of services available via the ESB.