[This is preliminary documentation and is subject to change.]
| C# | Visual Basic | Visual C++ |
public class SifResponseSender : IDisposable
Public Class SifResponseSender _ Implements IDisposable
public ref class SifResponseSender : IDisposable
| All Members | Constructors | Methods | |||
| Icon | Member | Description |
|---|---|---|
| SifResponseSenderSifResponseSenderNew()() | ||
| Close()() |
Close the stream and send one or more SIF_Response packets to the zone.
| |
| Dispose()() | ||
| Open(IZone, String, String, SifVersion, Int32, array<IElementDef>[]()) |
Open the SIFResponseSender to send SIF_Response messages to a specific zone.
| |
| Write(SifDataObject) |
Write a SIFDataObject to the output stream
| |
| Write(SIF_Error) |
Write a SIF_Error to the output stream
|
By design, the ADK automatically sends one or more SIF_Response messages to the zone when control is returned from the Publisher.OnRequest message handler. SIF_Responses are sent in a background thread without any further intervention on the agent's part. The ADK takes care of proper data object rendering and packetizing based on the parameters of the SIF_Request message, and includes a SIF_Error element in the payload if an exception is thrown from the onRequest method.
Although this behavior is convenient and very appropriate for most agent implementations, there are cases when agents require greater control over SIF Request & Response messaging. Specifically, agents sometimes need the ability to decouple SIF_Response processing from SIF_Request processing. For example, implementing the SIF 1.5 StudentLocator message choreography may require that SIF_Response messages are sent hours or days after the initial SIF_Request is received. Or, an agent might queue requests in a database table and work on them later when it has available resources. Both of these scenarios can be achieved by calling the DeferResponse()() method on the IDataObjectOutputStream passed to the Publisher.OnRequest message handler. This method signals the ADK to ignore any SifDataObjects written to the stream and to defer the sending of SIF_Response messages. The agent must send its own SIF_Response messages at a later time by using this SifResponseSender helper class
To use this class,- When the agent is ready to send SIF_Response messages for a SIF_Request that was received at an earlier time, instantiate a SifResponseSender.
- Call the Open(IZone, String, String, SifVersion, Int32, array<IElementDef>[]()) method and pass it the Zone you wish to send SIF_Response messages to. You must also pass the SIF_Version and SIF_MaxBufferSize value from the original SIF_Request message. (Be sure to obtain these values from the SifMessageInfo parameter in your Publisher.OnRequest implementation so you can pass them to the Open(IZone, String, String, SifVersion, Int32, array<IElementDef>[]()) method when using this class.)
- Repeatedly call the Write(SifDataObject) method, once for each SIFDataObject that should be included in the SIF_Response stream
- Call the Write(SIF_Error) method to include a SIF_Error element in the SIF_Response stream
- When finished, call the Close()() method. The ADK will automatically package the objects into one or more SIF_Response packets in the same way it does for normal request/response processing via the Publisher.OnRequest method.
| Object | |
| SifResponseSender | |