21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/omq/qos/socket_ext.rb', line 21
def qos=(value)
unless value.nil? || value.is_a?(OMQ::QoS)
raise ArgumentError,
"QoS must be nil (fire-and-forget) or an OMQ::QoS instance " \
"(OMQ::QoS.at_least_once / .exactly_once / .exactly_once_and_processed); " \
"received #{value.inspect}"
end
if value && FAN_OUT_TYPES.include?(@engine.socket_type)
raise ArgumentError,
"QoS > 0 is not supported for fan-out socket type #{@engine.socket_type}; " \
"use a broker (e.g. Malamute) for reliable fan-out"
end
current = @options.qos
if current && !current.equal?(value)
raise ArgumentError,
"OMQ::QoS already attached to this socket; a different instance " \
"cannot be assigned (reset to nil first if supported)"
end
@options.qos = value
value&.attach!(@engine)
end
|