Class: Lightstreamer::SendMessageOutcomeMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/lightstreamer/messages/send_message_outcome_message.rb

Overview

Helper class used by Session in order to parse incoming overflow send message outcome messages.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#errorLightstreamerError?

If an error occurred processing the message then it will be set here.

Returns:



21
22
23
# File 'lib/lightstreamer/messages/send_message_outcome_message.rb', line 21

def error
  @error
end

#numbersArray<Fixnum>

The message number(s) this message outcome is for. There will always be exactly one entry in this array except in the case where #error is a Errors::MessagesSkippedByTimeoutError in which case there may be more than one entry if multiple messages were skipped.

Returns:

  • (Array<Fixnum>)


16
17
18
# File 'lib/lightstreamer/messages/send_message_outcome_message.rb', line 16

def numbers
  @numbers
end

#sequenceString

The name of the sequence this message outcome is for.

Returns:

  • (String)


9
10
11
# File 'lib/lightstreamer/messages/send_message_outcome_message.rb', line 9

def sequence
  @sequence
end

Class Method Details

.parse(line) ⇒ Object

Attempts to parses the specified line as a message outcome message and returns an instance of Lightstreamer::SendMessageOutcomeMessage on success, or ‘nil` on failure.



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/lightstreamer/messages/send_message_outcome_message.rb', line 26

def parse(line)
  match = line.match Regexp.new '^MSG,([A-Za-z0-9_]+),(\d*),(?:DONE|ERR,(\d*),(.*))$'
  return unless match

  message = new

  message.sequence = match.captures[0]
  message.numbers = [match.captures[1].to_i]
  handle_error_outcome message, match.captures if match.captures.compact.size == 4

  message
end