def wait_for_reply(user_id, timeout)
      # We only want the reply to the supplied message_id, so set filter on message id
      filter = "#{Java::org.hornetq.api.core::FilterConstants::HORNETQ_USERID} = 'ID:#{user_id}'" if user_id
      @session.consumer(:queue_name => @reply_queue, :filter=>filter) do |consumer|
        consumer.receive(timeout)
      end
    end
def wait_for_reply(user_id, timeout)
      # We only want the reply to the supplied message_id, so set filter on message id
      filter = "#{Java::org.hornetq.api.core::FilterConstants::HORNETQ_USERID} = 'ID:#{user_id}'" if user_id
      @session.consumer(:queue_name => @reply_queue, :filter=>filter) do |consumer|
        consumer.receive(timeout)
      end
    end
Asynchronous wait for reply

 Parameters:
   user_id: the user defined id to correlate a response for

 Supply a nil user_id to receive any message from the queue

 Returns the message received

 Note: Call submit_request before calling this method