ZeroMQ and the SCA Binding

Using ZeroMQ as the SCA Binding

Typically, ZeroMQ is used as the default remote transport when no binding is configured (the "default" binding is called the SCA binding, or "binding.sca"). When used in this fashion, Fabric3 will automatically provision ZeroMQ sockets as well as propagate socket address information across clusters so that remote clients can connect. In addition, if socket address information changes (e.g. a runtime joins a cluster or drops out), this information will be automatically propagated and updates applied across clusters.

Assuming the ZeroMQ profile is installed in a runtime, the following example demonstrates how ZeroMQ can be used as the SCA binding:

<composite name="ClientComposite" ...>

    <component name="TestProducer">
        <implementation.java class="..."/>
        <reference name="service" target="TestService"/>
    </component>

</composite>

<composite name="ServiceComposite" ...>

    <component name="TestService">
        <implementation.java class="..."/>
    </component>

</composite>

Notice there is no binding configuration. If the ClientComposite and ServiceComposite are deployed to different zones, Fabric3 will create the appropriate ZeroMQ socket type to wire the components. The socket type chose will depend on the service contract. For example, a service contract with @OneWay operations will create a ZeroMQ non-blocking socket (ZMQ.PUSH). However, if the service contract has request-reply operations, a ZeroMQ request-response (ZMQ.XREQ) socket is created. Similarly, if the service interface requires a callback, Fabric3 will create a callback socket for replies.