Class Message
FIX message.
Inherited Members
Namespace: OnixS.Fix
Assembly: OnixS.Fix.Engine.dll
Syntax
public class Message : FieldSet, IDisposable, IMessage, IFieldSet, IEnumerable<Field>, IEnumerable
Constructors
Message(Message, MessageMemoryPool)
Creates the exact copy of the given message.
Declaration
public Message(Message message, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
Message | message | Source message to copy |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Exceptions
Type | Condition |
---|---|
NullReferenceException | if |
Message(String, Dictionary, Int32, MessageMemoryPool)
Creates a message of the specified type.
Declaration
public Message(string messageType, Dictionary dictionary, int contentsCapacity = 128, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
String | messageType | Message type (the MsgType (tag 35) field value) |
Dictionary | dictionary | Dictionary to be used during the message construction |
Int32 | contentsCapacity | size of buffer to store message field value |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Message(String, ProtocolVersion, Int32, MessageMemoryPool)
Creates a message of the specified type.
Declaration
public Message(string messageType, ProtocolVersion version, int contentsCapacity = 128, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
String | messageType | Message type (the MsgType (tag 35) field value) |
ProtocolVersion | version | FIX Protocol version to be used during the message construction |
Int32 | contentsCapacity | size of buffer to store message field value |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Properties
Dictionary
Dictionary that was used to construct the message.
Declaration
public Dictionary Dictionary { get; }
Property Value
Type | Description |
---|---|
Dictionary |
IsFlatMessage
Declaration
public bool IsFlatMessage { get; }
Property Value
Type | Description |
---|---|
Boolean |
Name
Message name.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
String | Message name |
SenderCompId
Assigned value used to identify firm sending message (the SenderCompID (tag=49) field value).
Declaration
public string SenderCompId { get; set; }
Property Value
Type | Description |
---|---|
String | SenderCompID |
SeqNum
Message sequence number (the MsgSeqNum (tag=34) field value).
Declaration
public int SeqNum { get; set; }
Property Value
Type | Description |
---|---|
Int32 | Message sequence number |
TargetCompId
Assigned value used to identify receiving firm (the TargetCompID (tag=56) field value).
Declaration
public string TargetCompId { get; set; }
Property Value
Type | Description |
---|---|
String | TargetCompID |
Type
Returns message type (the MsgType (tag=35) field value).
Declaration
public string Type { get; }
Property Value
Type | Description |
---|---|
String | message type |
Version
Financial Interface eXchange (FIX) protocol version.
Declaration
public ProtocolVersion Version { get; }
Property Value
Type | Description |
---|---|
ProtocolVersion | The FIX protocol version of the message |
Methods
Assemble(ByteBuffer)
Declaration
public override void Assemble(ByteBuffer bb)
Parameters
Type | Name | Description |
---|---|---|
ByteBuffer | bb |
Overrides
Clone()
Declaration
public Message Clone()
Returns
Type | Description |
---|---|
Message |
CompareType(Char)
Declaration
public bool CompareType(char type)
Parameters
Type | Name | Description |
---|---|---|
Char | type |
Returns
Type | Description |
---|---|
Boolean |
CompareType(String)
Declaration
public bool CompareType(string type)
Parameters
Type | Name | Description |
---|---|---|
String | type |
Returns
Type | Description |
---|---|
Boolean |
CopyFields(Message)
Copies all fields except the protocol version and message type from the given message.
Declaration
public void CopyFields(Message source)
Parameters
Type | Name | Description |
---|---|---|
Message | source | The source Message instance |
Equals(Object)
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
Object | o |
Returns
Type | Description |
---|---|
Boolean |
Overrides
GetEnumeratorOverRawMsg()
Returns an iterator over a raw FIX message as set of fields.
Note: Before any modifications to a FIX message the set of fields will be in the same order as they are received/parsed and will include duplicates.
Declaration
public virtual IEnumerator<Field> GetEnumeratorOverRawMsg()
Returns
Type | Description |
---|---|
IEnumerator<Field> | an Iterator. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
GetMessage()
Declaration
protected override Message GetMessage()
Returns
Type | Description |
---|---|
Message |
Overrides
GetPosition(Int32)
Declaration
protected override int GetPosition(int tag)
Parameters
Type | Name | Description |
---|---|---|
Int32 | tag |
Returns
Type | Description |
---|---|
Int32 |
Overrides
GetStructuredMessage(Dictionary, MessageValidationFlags)
Declaration
public Message GetStructuredMessage(Dictionary dictionary, MessageValidationFlags messageParsingFlags)
Parameters
Type | Name | Description |
---|---|---|
Dictionary | dictionary | |
MessageValidationFlags | messageParsingFlags |
Returns
Type | Description |
---|---|
Message |
Init(Message)
Initializes the message.
Declaration
public void Init(Message message)
Parameters
Type | Name | Description |
---|---|---|
Message | message | source FIX message to copy |
Exceptions
Type | Condition |
---|---|
NullReferenceException | if message == null |
Init(ReadOnlySpan<Byte>, MessageValidationFlags)
Initializes the message.
Declaration
public void Init(ReadOnlySpan<byte> rawMsg, MessageValidationFlags parsingFlags = MessageValidationFlags.None)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<Byte> | rawMsg | Raw FIX message in the tag=value form |
MessageValidationFlags | parsingFlags | Parsing flags |
Init(String, MessageValidationFlags)
Initializes the message.
Declaration
public void Init(string rawMessage, MessageValidationFlags parsingFlags = MessageValidationFlags.None)
Parameters
Type | Name | Description |
---|---|---|
String | rawMessage | Raw FIX message in the tag=value form |
MessageValidationFlags | parsingFlags | Parsing flags |
IsSessionLevel()
Returns true
if this is a session-level message, otherwise - false
.
Declaration
public bool IsSessionLevel()
Returns
Type | Description |
---|---|
Boolean |
|
Parse(FlatMessage, DictionaryManager, MessageValidationFlags, MessageMemoryPool)
Creates a Message instance on the base of the given FlatMessage object.
Declaration
public static Message Parse(FlatMessage flatMessage, DictionaryManager dictionaryManager, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
FlatMessage | flatMessage | Source FlatMessage |
DictionaryManager | dictionaryManager | DictionaryManager to be used during the message construction |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Parse(FlatMessage, Dictionary, MessageValidationFlags, MessageMemoryPool)
Creates a Message instance on the base of the given FlatMessage object.
Declaration
public static Message Parse(FlatMessage flatMessage, Dictionary dictionary, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
FlatMessage | flatMessage | Source FlatMessage |
Dictionary | dictionary | Dictionary to be used during the message construction |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Parse(Byte[], Int32, Int32, DictionaryManager, MessageValidationFlags, MessageMemoryPool)
Parses the byte array and creates the corresponding message.
Declaration
public static Message Parse(byte[] rawMessage, int offset, int length, DictionaryManager dictionaryManager, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | rawMessage | FIX message in the tag=value form |
Int32 | offset | message offset |
Int32 | length | message length in bytes |
DictionaryManager | dictionaryManager | DictionaryManager to be used during the message construction |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Exceptions
Type | Condition |
---|---|
NullReferenceException | if rawMsg == null |
Parse(Byte[], Int32, Int32, Dictionary, MessageValidationFlags, MessageMemoryPool)
Parses the byte array and creates the corresponding message.
Declaration
public static Message Parse(byte[] rawMessage, int offset, int length, Dictionary dictionary, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | rawMessage | FIX message in the tag=value form |
Int32 | offset | message offset |
Int32 | length | message length in bytes |
Dictionary | dictionary | Dictionary to be used during the message construction |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Parse(ReadOnlySpan<Byte>, DictionaryManager, MessageValidationFlags, MessageMemoryPool)
Parses the byte span and creates the corresponding message instance.
Declaration
public static Message Parse(ReadOnlySpan<byte> rawMessage, DictionaryManager dictionaryManager, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<Byte> | rawMessage | FIX message in the tag=value form |
DictionaryManager | dictionaryManager | DictionaryManager to be used during the message construction |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Exceptions
Type | Condition |
---|---|
NullReferenceException | if rawMessage == null |
Parse(ReadOnlySpan<Byte>, Dictionary, MessageValidationFlags, MessageMemoryPool)
Parses the byte span and creates the corresponding message instance.
Declaration
public static Message Parse(ReadOnlySpan<byte> rawMessage, Dictionary dictionary, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<Byte> | rawMessage | raw FIX message in the tag=value form |
Dictionary | dictionary | Dictionary to be used during the message construction |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Exceptions
Type | Condition |
---|---|
NullReferenceException | if rawMessage == null |
Parse(String, DictionaryManager, MessageValidationFlags, MessageMemoryPool)
Parses the raw FIX message string and creates the corresponding message.
Declaration
public static Message Parse(string rawMessage, DictionaryManager dictionaryManager, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
String | rawMessage | raw FIX message in the tag=value form |
DictionaryManager | dictionaryManager | DictionaryManager to be used during the message construction |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Exceptions
Type | Condition |
---|---|
NullReferenceException | if rawMessage == null |
Parse(String, Dictionary, MessageValidationFlags, MessageMemoryPool)
Parses the string and creates the corresponding message.
Declaration
public static Message Parse(string rawMessage, Dictionary dictionary, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
String | rawMessage | FIX message in the tag=value form |
Dictionary | dictionary | Dictionary to be used during the message construction |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Exceptions
Type | Condition |
---|---|
NullReferenceException | if rawMessage == null |
Parse(String, MessageValidationFlags, MessageMemoryPool)
Parses the string and creates the corresponding message.
Declaration
public static Message Parse(string rawMessage, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
String | rawMessage | FIX message in the tag=value form |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Exceptions
Type | Condition |
---|---|
NullReferenceException | if rawMessage == null |
Parse(String, ProtocolVersion, MessageValidationFlags, MessageMemoryPool)
Parses the string and creates the corresponding message.
Declaration
public static Message Parse(string rawMessage, ProtocolVersion version, MessageValidationFlags parsingFlags = MessageValidationFlags.None, MessageMemoryPool memoryPool = null)
Parameters
Type | Name | Description |
---|---|---|
String | rawMessage | FIX message in the tag=value form |
ProtocolVersion | version | ProtocolVersion to be used during the message construction |
MessageValidationFlags | parsingFlags | Parsing flags |
MessageMemoryPool | memoryPool | memory pool for pre-allocated objects |
Returns
Type | Description |
---|---|
Message |
Exceptions
Type | Condition |
---|---|
NullReferenceException | if rawMessage == null |
Remove(Int32)
Declaration
public override bool Remove(int tag)
Parameters
Type | Name | Description |
---|---|---|
Int32 | tag |
Returns
Type | Description |
---|---|
Boolean |
Overrides
Reset()
Resets to the clean, non-initialized state.
Declaration
public void Reset()
Set(Int32, Byte[], Int32, Int32)
Declaration
public override IFieldSet Set(int tag, byte[] value, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
Int32 | tag | |
Byte[] | value | |
Int32 | offset | |
Int32 | length |
Returns
Type | Description |
---|---|
IFieldSet |
Overrides
Set(Int32, ReadOnlySpan<Byte>)
Declaration
public override IFieldSet Set(int tag, ReadOnlySpan<byte> value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | tag | |
ReadOnlySpan<Byte> | value |
Returns
Type | Description |
---|---|
IFieldSet |
Overrides
Set(Int32, String)
Declaration
public override IFieldSet Set(int tag, string value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | tag | |
String | value |
Returns
Type | Description |
---|---|
IFieldSet |
Overrides
Set(Int32, StringBuilder)
Declaration
public override IFieldSet Set(int tag, StringBuilder value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | tag | |
StringBuilder | value |
Returns
Type | Description |
---|---|
IFieldSet |
Overrides
ToBytes(Span<Byte>)
Serializes the message to the given byte span.
Declaration
public int ToBytes(Span<byte> buffer)
Parameters
Type | Name | Description |
---|---|---|
Span<Byte> | buffer | Byte span to serialize the message content to |
Returns
Type | Description |
---|---|
Int32 | The number of copied bytes if the given span is large enough; otherwise - a negative number, the absolute value of which is equal to the required size of the span |
ToJson()
Returns the JSON representation.
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
String | JSON representation |
ToXml()
Returns the XML representation.
Declaration
public string ToXml()
Returns
Type | Description |
---|---|
String | XML representation |
UpdateBodyLengthAndCheckSum()
Updates the BodyLength (tag 9) and CheckSum (tag 10) fields.
Declaration
public void UpdateBodyLengthAndCheckSum()
Validate(MessageValidationFlags)
Validates the message.
Declaration
public void Validate(MessageValidationFlags validationFlags = MessageValidationFlags.StrictCreated)
Parameters
Type | Name | Description |
---|---|---|
MessageValidationFlags | validationFlags | Validation flags |
Exceptions
Type | Condition |
---|---|
ParserException | if the message is not valid |
Explicit Interface Implementations
IMessage.Clone()
Declaration
IMessage IMessage.Clone()
Returns
Type | Description |
---|---|
IMessage |