This section describes the usage of the OnixS::FIX::FAST::EventBasedDecoder class together with OnixS::FIX::FAST::IDecodeListener interface.
FAST decoder could be used in a callback mode, which called 'event based' one. Within this mode, decoder does not create FIX message by itself, but instead of this, it notifies a user about different stages of the decoding process. These notification are sent using special interface (OnixS::FIX::FAST::IDecodeListener), which should be passed to the decoder as parameter of OnixS::FIX::FAST::EventBasedDecoder::decode method.
See the table below to consult about decoding process stages and callbacks.
Decoder position | Listener callback | ||
Message decode beginning Decoder just got template identifier from input FAST stream and appropriate FIX message type identifier was detected. Both identifiers are passed to the callback through appropriate parameters. | OnixS::FIX::FAST::IDecodeListener::onBeginMessage | ||
Simple field | Field value decoded Decoder just decoded a simple field; it means that appropriate input data was read, and required FAST operator was applied to. The "simple" term means a field of one of the following FAST types:
Note: When decoding results in NULL value, there is no callback performed. | OnixS::FIX::FAST::IDecodeListener::onValue (depends on the actual field type) | |
Sequence | Sequence beginning Decoder just desired that input data contains non-empty sequence (length of the sequence is not zero). No any entries were decoded yet. Note, that there are no separate call for <length> field of sequence: length of the sequence is passed to the callback through appropriate parameter. See FAST specification about <sequence> instruction for details about sequence tag detection scheme. | OnixS::FIX::FAST::IDecodeListener::onBeginSequence | |
Sequence entry (steps repeated for each one entry of the sequence) | Entry beginning Decoder just desired index of the current entry. This index is passed through appropriate parameter of the callback. | OnixS::FIX::FAST::IDecodeListener::onBeginSequenceEntry | |
Entry body The sequence entry could be of any type allowed by FAST specification: a simple field, embedded sequence or a group. Therefore, the decoder will generate callback(s) here in accordance to the template specification. | Depend on a type of the entry. | ||
Entry ended Decoder just finished decoding of the entry. | OnixS::FIX::FAST::IDecodeListener::onEndSequenceEntry | ||
Sequence ended Decoder finished sequence decoding. | OnixS::FIX::FAST::IDecodeListener::onEndSequence | ||
Group | Group beginning Decoder just desired that input data contains non-empty group. See FAST specification about <group> instruction. | OnixS::FIX::FAST::IDecodeListener::onBeginGroup | |
Group entry | The group entry could be of any type allowed by FAST specification: a simple field, embedded sequence or another group. Therefore, decoder will generate callback(s) here in accordance to the template specification. | Depend on a type of the entry. | |
Group ended Decoder just finished the group decoding. | OnixS::FIX::FAST::IDecodeListener::onEndGroup | ||
Message decode ended Message decoding was successfully completed. | OnixS::FIX::FAST::IDecodeListener::onEndMessage |
Whenever decoder meets data or another error occurs, it just throws C++ exception of the OnixS::FIX::Exception type. Decoding process becomes broken, and no more callback will be performed.