SCA composites and wiring

An application developer creates SCA composites by wiring services and references together. A wire is a connector that passes control and data from a component to a target.

You can wire components together in a composite in two ways using IBM® Developer for Z :
Promotion
You can wire a composite service by promoting a component service that is defined on one of the components in the composite. Similarly, a composite reference can promote a component reference. You cannot promote a composite service to another composite service or a composite reference to a composite reference. If you add a binding to a service or reference, the binding attributes on a promoted composite service or reference take precedence over attributes on the component service or reference.

It is not possible to promote an internal service if the external service is using a different type of binding; for example, if an external service has a CICS binding, the internal service cannot have a web service binding.

Target
You can directly wire a component reference to another component service by specifying a target attribute on the reference to connect two components together in a composite. This wiring is internal to the composite. Similarly, you can specify a target attribute on a composite reference to wire two composites together. This wiring is typical in complex composites.

A simple composite

A composite can contain two or more components that are wired together. In the following example, composite A has two components. Component A has a dependency on component B for its service. Each component has a service and a reference. The bindings defined in the reference of component A and the service of component B must be compatible. Composite A encapsulates the two components, hiding the lower-level implementation details from applications that require the service offered by composite A.

The external service and reference of the composite are formed by promoting the service of component A and the reference of component B. The wire between component A and B is a target, where the bindings on each interface are the same. In this example, the components are using a CICS binding.

This diagram shows a box representing a composite called Composite A in SCA. Entering the box on the left is a large arrow that represents a Service. This large arrow connects with a dotted line to a small arrow that represents the internal Service for component A. The small arrow is entering a small box that represents component A. Exiting component A on the right, is a small arrow that represents the internal Reference for the component. This small arrow connects to the small Service arrow of component B with a full line that represents a wire. The small Service arrow is entering a small box that represents component B. Exiting component B on the right is a small arrow that represents the internal Reference for component B. This small arrow connects with a dotted line to the large Reference arrow that is exiting the composite.

A complex composite

The model for encapsulating the implementation details in components is a very flexible way to create hierarchical composite applications. In the following example, composite Y contains two components. However, in this example, the implementation of component C is itself a composite that has two components inside it. Any client that wants to call the service offered by composite Y does not require knowledge of the components that are in composite C, meaning that the underlying implementation details can change without affecting the client.

The external service and reference of composite Y is formed by promoting the service of component C and the reference of component D. The wire between component C and D is a target, where the bindings on each interface are the same. In this example, the components are using a CICS binding.

This diagram shows a box representing a composite called Composite Y in SCA. Composite Y has the same composition as Composite A with two components wired together. However, the implementation of the first component is expanded to show that the component is another composite that contains two wired components.