Class Qpid::Messaging::Sender
In: qpid/ruby/lib/qpid_messaging/sender.rb
Parent: Object

Sender is the entity through which messages are sent.

An instance of Sender can only be created using an active (not previously closed) Session. See Qpid::Messaging::Session.create_sender for more details.


  # create a connection
  conn = "mybroker:5672"


    # create a session
    session = conn.create_session

    # create a sender that posts messages to the "updates" queue
    sender = session.create_sender "updates;{create:always}

    # begin sending updates
    loop do
      # wait for the next event content then send it
      content = wait_for_event
      sender.send :content => content


available   capacity   capacity=   close   name   send   session   unsettled  

Public Instance methods

Returns the available slots for sending messages.

This differs from capacity in that it is the available slots in the senders capacity for holding outgoing messages. The difference between capacity and available is the number of messages that have not been delivered yet.

Returns the capacity.

Sets the capacity for this Sender.

The capacity is the number of outgoing messages that can be held pending confirmation of receipt by the broker.


Closes this Sender.

This does not affect the owning Session or Connection.

Returns the human-readable name for this Sender.

Sends a message, optionally blocking until the message is received by the broker.


  • message - The message to send.
  • +:sync+ - Block until received. See note below on synching.


If :sync => true, then the call will block until the broker confirms receipt of the message. Otherwise it will only block for available capacity; i.e., until pending is equal to capacity.


  # send a message
  outgoing = :content => content
  sender.send outgoing

  # send a message, wait for confirmation from the broker
  outgoing = :content => content
  sender.send outgoing, :sync => true

Returns the Session for this sender.

Returns the number of messages sent that are pending receipt confirmation by the broker.