Local and Remote Channels

This section outlines the differences between local and remote channels.

Local Channels

Channels may be configured with bindings. If producers and consumers are connected to a channel with no bindings and all are in the same zone, the channel is local. That is, events will be sent in-VM and not over a remote transport.

If a local channel is deployed to a clustered zone (that is, a zone with two or more runtimes), by default events will not be replicated between runtimes. The following figure illustrates a non-replicating channel deployed to two runtimes in the same zone: 

In the above scenario, event A sent by the producer hosted on the first runtime will only be received by the two consumers on the first runtime. Likewise, event B sent by the producer on the second runtime will only be received by the consumers on the second two consumers on the second runtime. 

Remote Channels

A channel is considered remote in two cases:

  • The channel is configured with a binding
  • The channel is deployed in a different zone than connected producers and consumers
Bound Channels

If a channel is configured with a binding, events sent by connected producers will be dispatched to the remote transport specified by the binding, regardless of whether the producer is in the same zone as the channel. Explicitly configuring a channel binding in this way is useful when events need to be observed by a system that is external to the domain. Configuring a channel binding is also useful when external events need to be observed by a consumer. In this case, a bound channel will listen on a remote transport and forward events sent by remote systems to connected consumers.

Remote Producers and Consumers

If a channel is deployed to a different zone than connected producers or consumers, Fabric3 will bind the channel to a broadcast-capable remote transport (for example, a JMS Topic or ZeroMQ Pub/Sub socket). In this scenario, events will be replicated to all connected consumers, regardless of their origin. The following figure shows this:

Replicating Channels

Local channels can be configured to replicate events to all runtimes in a zone by setting the requires attribute on the channel definition as follows:

<composite xmlns:f3="urn:fabric3.org" ...>

   <channel name="SomeChannel" requires="f3:replication"/>

<composite>

In this scenario, events emitted by the producers on both runtimes will be received by all consumers connected to the channel in the zone. The following figure illustrates event replication: 

For applications that require events to be broadcast across JVMs, using bound channel is recommended over a local replicating channel as performance is likely to be better.