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 collapse

Instance Method Summary collapse

Methods inherited from Link

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

Methods inherited from Endpoint

#closed?, #local_closed?, #local_open?, #local_uninit?, #open?, #remote_closed?, #remote_open?, #remote_uninit?, #transport, #work_queue

Instance Attribute Details

#auto_settleBoolean (readonly)

Returns auto_settle flag, see #open.

Returns:

  • (Boolean)

    auto_settle flag, see #open



54
55
56
# File 'lib/core/sender.rb', line 54

def auto_settle
  @auto_settle
end

Instance Method Details

#delivery_tag

Deprecated.

internal use only



91
# File 'lib/core/sender.rb', line 91

def delivery_tag() deprecated(__method__); next_tag; end

#offered(n)

Hint to the remote receiver about the number of messages available. The receiver may use this to optimize credit flow, or may ignore it.

Parameters:

  • n (Integer)

    The number of deliveries potentially available.



59
60
61
# File 'lib/core/sender.rb', line 59

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

#open_sender(address) #open_sender(opts)

Open the Qpid::Proton::Sender link

Overloads:

  • #open_sender(address)

    Parameters:

    • address (String)

      address of the target to send to

  • #open_sender(opts)

    messages upon receiving a settled disposition for that delivery. Otherwise messages must be explicitly settled.

    Options Hash (opts):

    • :auto_settle (Boolean) — default: true

      If true (default), automatically settle

    • :dynamic (Boolean) — default: false

      dynamic property for source Terminus#dynamic

    • :source (String, Hash)

      source address or source options, see Terminus#apply

    • :target (String, Hash)

      target address or target options, see Terminus#apply

    • :name (String) — default: generated

      unique name for the link.



42
43
44
45
46
47
48
49
50
51
# File 'lib/core/sender.rb', line 42

def open(opts=nil)
  opts = { :target => opts } if opts.is_a? String
  opts ||= {}
  target.apply opts[:target]
  source.apply opts[:source]
  target.dynamic = !!opts[:dynamic]
  @auto_settle = opts.fetch(:auto_settle, true)
  super()
  self
end

#send(message) ⇒ Tracker

Send a message.

Parameters:

  • message (Message)

    The message to send.

Returns:

  • (Tracker)

    Tracks the outcome of the message.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/core/sender.rb', line 69

def send(message, *args)
  tag = nil
  if args.size > 0
    # deprecated: allow tag in args[0] for backwards compat
    raise ArgumentError("too many arguments") if args.size > 1
    tag = args[0]
  end
  tag ||= next_tag
  t = Tracker.new(Cproton.pn_delivery(@impl, tag))
  Cproton.pn_link_send(@impl, message.encode)
  Cproton.pn_link_advance(@impl)
  t.settle if snd_settle_mode == SND_SETTLED
  return t
end

#stream(bytes)

Deprecated.

use #send



85
86
87
88
# File 'lib/core/sender.rb', line 85

def stream(bytes)
  deprecated __method__, "send"
  Cproton.pn_link_send(@impl, bytes)
end