Class: Qpid::Proton::Sender

Inherits:
Link show all
Defined in:
lib/core/sender.rb

Overview

The sending endpoint.

See Also:

Constant Summary

Constants inherited from Link

Link::RCV_FIRST, Link::RCV_SECOND, Link::SND_MIXED, Link::SND_SETTLED, Link::SND_UNSETTLED

Constants inherited from Endpoint

Endpoint::LOCAL_ACTIVE, Endpoint::LOCAL_CLOSED, Endpoint::LOCAL_MASK, Endpoint::LOCAL_UNINIT, Endpoint::REMOTE_ACTIVE, Endpoint::REMOTE_CLOSED, Endpoint::REMOTE_MASK, Endpoint::REMOTE_UNINIT

Instance Attribute Summary

Attributes inherited from Link

#available, #credit, #name, #queued, #receiver?, #remote_credit, #sender?, #state

Instance Method Summary collapse

Methods inherited from Link

#==, #advance, #close, #connection, #current, #delivery, #detach, #drained, #error, #next, #open, #rcv_settle_mode, #rcv_settle_mode=, #remote_source, #remote_target, #session, #snd_settle_mode, #snd_settle_mode=, #source, #target

Methods inherited from Endpoint

#check_state, #handler, #handler=, #local_active?, #local_closed?, #local_uninit?, #remote_active?, #remote_closed?, #remote_uninit?, #transport

Instance Method Details

#delivery_tagObject



67
68
69
70
71
72
# File 'lib/core/sender.rb', line 67

def delivery_tag
  @tag_count ||= 0
  result = @tag_count.succ
  @tag_count = result
  return "#{result}"
end

#offered(n) ⇒ Object

Signals the availability of deliveries.

Parameters:

  • n (Fixnum)

    The number of deliveries potentially available.



38
39
40
# File 'lib/core/sender.rb', line 38

def offered(n)
  Cproton.pn_link_offered(@impl, n)
end

#send(object, tag = nil) ⇒ Fixnum

Sends the specified data to the remote endpoint.

Parameters:

  • object (Object)

    The content to send.

  • tag (Object) (defaults to: nil)

    The tag

Returns:

  • (Fixnum)

    The number of bytes sent.



49
50
51
52
53
54
55
# File 'lib/core/sender.rb', line 49

def send(object, tag = nil)
  if object.respond_to? :proton_send
    object.proton_send(self, tag)
  else
    stream(object)
  end
end

#stream(bytes) ⇒ Object

Send the specified bytes as part of the current delivery.

Parameters:

  • bytes (Array)

    The bytes to send.



63
64
65
# File 'lib/core/sender.rb', line 63

def stream(bytes)
  Cproton.pn_link_send(@impl, bytes)
end