Transport Restrictions with Inline Mode

Inline mode restricts underlying transports. Read this entire topic carefully to ensure proper conformance with the restriction.

Note: When a transport is associated with an inline event queue, it cannot be associated with any other event queue.

Violating this principle results in an illegal state exception. (The add subscriber API call throws this exception when the program attempts to add a subscriber that would violate the principle.)

When specifying inline mode, programmers must coordinate with administrators to avoid illegal state exceptions.

Programmer Violation

The first diagram illustrates the simplest violation, attributable entirely to programmer error. The programmer creates two subscribers (S1 and S2) from a single endpoint (E1), and adds them to two event queues, at least one of which (Q1) is an inline queue. This situation would associate the underlying transport (T1) of the subscribers with two incompatible queues (Q1 and Q2), violating the restriction.

Illegal Inline Queue, Simple Case

To rectify the violation, either add both subscribers to a single inline event queue (Q1), or to two ordinary event queues, neither of which use inline mode.

Hidden Violation

While it would appear straightforward for programmers to avoid the violation of the simple case of the first diagram, the situation is more complicated because responsibilities are divided between programmers and administrators.

From a programmer’s perspective, transports are ordinarily hidden behind endpoint names. Conversely, administrators can ordinarily employ transports to implement endpoints without understanding the specifics of subscribers and queues in application programs. However, inline mode tightly couples transport I/O to program code, which in turn blurs the usual separation of responsibilities between programmer and administrator. As a result, the restriction requires that programmers and administrators coordinate whenever a program uses inline event queues.

Consider the following example. The situation in the second diagram might appear correct from the separate perspectives of the programmer and the administrator, but combining their perspectives reveals a hidden violation.

Illegal Inline Queue, Hidden Violation

The programmer instantiates two subscribers (S1 and S2) on two separate endpoints (E1 and E2), and associates them with separate queues (Q1 and Q2). Q1 is an inline queue.

Meanwhile, the administrator employs a single transport (T1) to implement the two endpoints (E1 and E2).

Because T1 is associated with Q1, which is an inline queue, this arrangement violates the principle. When the program adds S2 to Q2, the add subscriber call throws an exception, whether or not Q2 uses inline mode.

By coordinating their information, the programmer and administrator can cooperate to avoid the violation in any of three ways:

Separate Transports to Correct a Violation

In the third diagram, transport T1 is associated with only one inline event queue, Q1. This arrangement does not violate the restriction.

Legal Inline Queue, Separate Transports

Single Queue to Correct a Violation

In the fourth diagram, even though two subscribers (S1 and S2) share the same underlying transport (T1), they are associated with the same inline event queue (Q1). This arrangement does not violate the restriction.

Legal Inline Queue, Single Queue