Class: Qpid::Proton::Sender

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

Overview

The sending endpoint.

See Also:

Constant Summary

Constants inherited from Link

Link::PROTON_METHOD_PREFIX, 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

Constants included from Util::Deprecation

Util::Deprecation::DEPRECATE_FULL_TRACE, Util::Deprecation::MATCH_DIR

Instance Attribute Summary collapse

Attributes inherited from Link

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

Attributes included from Util::Wrapper

#impl

Instance Method Summary collapse

Methods included from Util::ErrorHandler

#can_raise_error, #check_for_error, #create_exception_handler_wrapper, included

Methods inherited from Link

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

Methods included from Util::Wrapper

included, #inspect, registry, #to_s

Methods inherited from Endpoint

#check_state, #closed?, #condition, #local_closed?, #local_condition, #local_open?, #local_uninit?, #open?, #remote_closed?, #remote_condition, #remote_open?, #remote_uninit?, #transport, #work_queue

Methods included from Util::Deprecation

deprecated, #deprecated, included

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_tagObject

Deprecated.

internal use only



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

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

#offered(n) ⇒ Object

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) ⇒ Object #open_sender(opts) ⇒ Object

Open the Qpid::Proton::Sender link

Overloads:

  • #open_sender(address) ⇒ Object

    Parameters:

    • address (String)

      address of the target to send to

  • #open_sender(opts) ⇒ Object

    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) ⇒ Object

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