Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: adding rationale for subscription

...

You should have already completed the following lessons:

...

Subscriptions play an important role in building systems of picos. In Lesson 3. Pico-based systemsBased Systems, you created child picos. If the parent-child relationship were the only one that existed, we could create hierarchies of picos, but not peer-to-peer systems of picos. Subscriptions allow us to establish relationships between any two picos. 

...

Wrangler provides functions, actions, and rules for managing subscriptions from within your KRL code.

The following sequence diagram illustrates a point at which a subscription will be needed. You will recall from the previous lesson that the section collection pico may handle the event section needed. Once the section pico is ready, the section collection pico could assign it a new channel and send the ECI to it's parent, the registration pico. Similarly (code left as an exercise) the student collection pico could inform it's parent (also the registration pico) of a private ECI for the appropriate student pico. Having both ECI's, the registration pico could introduce the two picos to each other, so that they now share a subscription. This introduction, and the creation of the subscription, are represented by blue arrows.

"Stu" represents the pico for the student "Alice" and "Sec" represents the pico for section "A". Remember that there might be thousands of students and thousands of sections, of which this diagram shows only one of each.

Image Added

We saw in the previous lesson, that when the section collection pico handles the event section needed, it may be able to provide it immediately, because it already exists, or we may need to create and initialize a new pico before it becomes available. This is illustrated by the note "possible creation of pico Sec". Also, we saw that the section pico might write its roster to the database and then ask to be deleted (by sending the event section offline to the section collection pico. This is illustrated by the note "possible end of pico(s)". Similar remarks hold for student picos.