Sha256: 91757e92d9955f59ffa98b452907f157e4be98d4e44430780419e4329bc06c1d

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

# TODO Support send(String)
# TODO Support send(:data => string, :durable=>true, :address=>'MyAddress')
#
# See: http://hornetq.sourceforge.net/docs/hornetq-2.1.2.Final/api/index.html?org/hornetq/api/core/client/ClientProducer.html
# 
# Other methods still directly accessible through this class:
#
# void 	send(Message message)
#          Sends a message to an address
# void 	send(String address, Message message)
#          Sends a message to the specified address instead of the ClientProducer's address
#          
#	close()
#          Closes the ClientProducer
# boolean 	closed?
#          Returns whether the producer is closed or not
#          
# SimpleString 	address()
#          Returns the address where messages will be sent
#          
# int 	max_rate()
#          Returns the maximum rate at which a ClientProducer can send messages per second
#          
# boolean 	block_on_durable_send?
#          Returns whether the producer will block when sending durable messages
# boolean 	block_on_non_durable_send?
#          Returns whether the producer will block when sending non-durable messages
#          
class Java::org.hornetq.core.client.impl::ClientProducerImpl
  def send_with_retry(message)
    first_time = true
    begin
      send(message)
    rescue Java::org.hornetq.api.core.HornetQException => e
      HornetQ.logger.warn "Received producer exception: #{e.message} with code=#{e.cause.code}"
      if first_time && e.cause.code == Java::org.hornetq.api.core.HornetQException::UNBLOCKED
        HornetQ.logger.info "Retrying the send"
        first_time = false
        retry
      else
        raise
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jruby-hornetq-0.4.0 lib/hornetq/client/org_hornetq_core_client_impl_client_producer_impl.rb
jruby-hornetq-0.3.3 lib/hornetq/client/org_hornetq_core_client_impl_client_producer_impl.rb