# Appendix F: Selective Message Blocking (SMB) Example

## F.1 Example

A detailed example of Selective Message Blocking (SMB) follows. The table below represents the agent's message queue as maintained by the ZIS. The message at the top represents the oldest message in the queue and is the message that is currently being processed by the agent as the example begins.

Agent Message Queue
`SIF_Event` message containing a `StudentSchoolEnrollment` object with an `Action` of `Add`.
`SIF_Event` message containing a `StudentPersonal` object with an `Action` of `Add`.
`SIF_Request` message for a `StudentPersonal` object from another agent.
`SIF_Event` message containing a `StudentSchoolEnrollment` object with an `Action` of `Add`.

Table F.1-1: Agent Message Queue - Example 1

When processing the `StudentSchoolEnrollment` event, the agent requires data from a `SchoolInfo` object that it doesn't have locally. It would like to request the `SchoolInfo` object without needing to process subsequent events. To do so, the agent acknowledges the `StudentSchoolEnrollment` event with an "Intermediate" `SIF_Ack` indicating that the ZIS will be contacted later to resume delivery of events. It then opens a channel to the ZIS and submits a `SIF_Request` for the `SchoolInfo` object.

Upon receipt of the "Intermediate" `SIF_Ack`, the ZIS freezes the delivery of any `SIF_Event` messages to this agent until the agent sends a final `SIF_Ack` releasing the original event. The current state of the queue is now:

Agent Message Queue
`SIF_Event` message containing a `StudentSchoolEnrollment` object with an `Action` of `Add`. (blocked)
`SIF_Event` message containing a `StudentPersonal` object with an `Action` of `Add`. (frozen)
`SIF_Request` message for a `StudentPersonal` object from another agent.
`SIF_Event` message containing a `StudentSchoolEnrollment` object with an `Action` of `Add`. (frozen)

Table F.1-2: Agent Message Queue - Example 2

The next message available for delivery to the agent is the `SIF_Request` for a `StudentPersonal` object. For our example, the agent will accept the `SIF_Request` by returning an "Immediate" `SIF_Ack` indicating that processing is complete and the agent will hand the `SIF_Request` off to another part of the agent for handling.

Meanwhile, the ZIS has deposited the `SIF_Response` from the `SchoolInfo` provider's agent into the queue. The queue now looks like this:

Agent Message Queue
`SIF_Event` message containing a `StudentSchoolEnrollment` object with an `Action` of `Add`. (blocked)
`SIF_Event` message containing a `StudentPersonal` object with an `Action` of `Add`. (frozen)
`SIF_Event` message containing a `StudentSchoolEnrollment` object with an `Action` of `Add`. (frozen)
`SIF_Response` message containing the `SchoolInfo` object previously requested.

Table F.1-3: Agent Message Queue - Example 3

The next message the agent receives is the `SIF_Response`. The agent takes the `SIF_Response` and uses the information from it along with the data in the original `StudentSchoolEnrollment` event to update its database. The agent returns (Pull-Mode) or sends (Push-Mode) an "Immediate" `SIF_Ack` telling the ZIS to discard the `SIF_Response` message.

The agent has now completed processing of the `StudentSchoolEnrollment` event and opens a channel to the ZIS and sends a "Final" `SIF_Ack` with the message identifier for the `StudentSchoolEnrollment` event. The `SIF_Ack` says that the agent has completed processing and the ZIS removes the event from the agent queue. The freeze on `SIF_Event` messages is lifted and the next message to be sent to the agent is the `SIF_Event` for a `StudentPersonal` Add:

Agent Message Queue
`SIF_Event` message containing a `StudentPersonal` object with an `Action` of `Add`.
`SIF_Event` message containing a `StudentSchoolEnrollment` object with an `Action` of `Add`.

Table F.1-4: Agent Message Queue - Example 4

##### "Immediate" SIF_Ack

The "Immediate" `SIF_Ack` is a `SIF_Ack` message with status code of `1`. This type of `SIF_Ack` is returned as a response to a message sent by the ZIS and indicates that the agent has persisted or has processed the message and the ZIS must remove the message from its queue.

<SIF_Message Version="2.0r1" xmlns="http://www.sifinfo.org/infrastructure/2.x"> <SIF_Ack> <SIF_Header> <SIF_MsgId>ABCD10580EF250789012AC0554321EA2</SIF_MsgId> <SIF_Timestamp>2006-02-18T08:39:40-08:00</SIF_Timestamp> <SIF_SourceId>RamseyLIB</SIF_SourceId> </SIF_Header> <SIF_OriginalSourceId>RamseySIS</SIF_OriginalSourceId> <SIF_OriginalMsgId>10580EF2ABCD50789012AC05EA6C71B3</SIF_OriginalMsgId> <SIF_Status> <SIF_Code>1</SIF_Code> </SIF_Status> </SIF_Ack> </SIF_Message>
Example F.1-1: "Immediate" SIF_Ack

##### "Intermediate" SIF_Ack

The "Intermediate" `SIF_Ack` is a `SIF_Ack` message with status code of `2`. This type of `SIF_Ack` is returned as a response to an event message delivered by the ZIS and indicates that the agent has not completed processing of the event and the ZIS must not remove the event message from its queue. The agent will send a "Final" `SIF_Ack` to the ZIS in the future to signal that the ZIS can discard the event message. An "Intermediate" `SIF_Ack` message must not be returned by agents in response to messages other than `SIF_Event`.

<SIF_Message Version="2.0r1" xmlns="http://www.sifinfo.org/infrastructure/2.x"> <SIF_Ack> <SIF_Header> <SIF_MsgId>ABCD10580EF250789012AC0554321EA3</SIF_MsgId> <SIF_Timestamp>2006-02-18T08:39:40-08:00</SIF_Timestamp> <SIF_SourceId>RamseyLIB</SIF_SourceId> </SIF_Header> <SIF_OriginalSourceId>RamseySIS</SIF_OriginalSourceId> <SIF_OriginalMsgId>10580EF2ABCD50789012AC05EA6C71B3</SIF_OriginalMsgId> <SIF_Status> <SIF_Code>2</SIF_Code> </SIF_Status> </SIF_Ack> </SIF_Message>
Example F.1-2: "Intermediate" SIF_Ack

##### "Final" SIF_Ack

A "Final" `SIF_Ack` is a message with status code of `3`. The agent sends this type of `SIF_Ack` to the ZIS after the agent has completely processed a `SIF_Event` where it previously sent an "Intermediate" `SIF_Ack`. When the ZIS receives this message, it must discard the `SIF_Event` message referenced in the `SIF_Ack` upon successfully acknowledging the "Final" `SIF_Ack`.

<SIF_Message Version="2.0r1" xmlns="http://www.sifinfo.org/infrastructure/2.x"> <SIF_Ack> <SIF_Header> <SIF_MsgId>ABCD10580EF250789012AC0554321EA4</SIF_MsgId> <SIF_Timestamp>2006-02-18T08:39:40-08:00</SIF_Timestamp> <SIF_SourceId>RamseyLIB</SIF_SourceId> </SIF_Header> <SIF_OriginalSourceId>RamseySIS</SIF_OriginalSourceId> <SIF_OriginalMsgId>10580EF2ABCD50789012AC05EA6C71B3</SIF_OriginalMsgId> <SIF_Status> <SIF_Code>3</SIF_Code> </SIF_Status> </SIF_Ack> </SIF_Message>
Example F.1-3: "Final" SIF_Ack